Background

In the last post, I explained how to crawl the historical data of the Fear-and Greed Index released on the CNN site and store it as a CSV file.

Crawling historical CNN-Fear-and-Greed Index data
Learn how to crawl the historical data of CNN-Fear-and Greed Index and save it as a CSV file.

If this index is an indicator of the true sentiment of the US stock market, what about the investment performance by using it? ๐Ÿ™„
In this post, I will create a simple ETF investment strategy using CNN-Fear-and-Greed Index and backtest simulated strategy at Google Spreadsheet ~
I'll share the Google Spreadsheet with all processes and results at the bottom, so please follow the posting after examine the document.

๐Ÿ’ก
The shared Google Spreadsheet can be saved in your Google Drive through "File"> "Save as Copy" and then freely use it!
Fear-Greed-Model-by-izycodes
etf_price_googlefinance NYSEARCA:SPY,NYSEARCA:SPYDate,Open,Datevalue,Open,Date,Close,Datevalue,Close2020. 5. 28,304.65,43979,304.65,2020. 5. 28 ์˜คํ›„ 4:00:00,302.97,43979,302.972020. 5. 29,302.46,43980,302.46,2020. 5. 29 ์˜คํ›„ 4:00:00,304.32,43980,304.322020. 6. 1,303.62,43983,303.62,2020. 6. 1 ์˜คํ›„...

Prework

SPY ETF stock price data

The ETF which I selected for backtesting is SPY ETF (SPDR S&P 500 Trust ETF) and I imported historical daily price first. If you use the GoogleFinance() function, you can load the data of the desired period from the Google Spreadsheet, so please refer to the official document With the functions, I loaded last 1000 day's opening ("open") and closing price ("Close") of SPY ETF.

=GoogleFinance("NYSEARCA:SPY", "open", TODAY()-1000, TODAY(),"daily")

Prepare historical CNN-Fear-and-Greed Index data

For getting CNN-Fear-and-Gred index, you can load the CSV file obtained from the previous post to Google Spreadsheet ("File"> "Import"). I prepared the data at the column A to C in "index_data_simulation" sheet.
(Only data after "2021-02-01" seemed to be valid, so I used data for about two years from 2021-02-01 to 2023-02-09.)

Establishing a trading strategy

I've applied a realistic and simple trading logic as follows:

  • Based on the rating value of the previous day's Fear-and-greed index, Adjust SPY ETF's weight of portfolio today. )
  • Assume that all trade is excuted at opening price(because it is the earlist timeframe after index revealed), and the cost of trade is 0.25% of the trading amount.
  • The portfolio weight of SPY ETF according to the rating value of the Fear-and-Greed Index is the same as the bottom. The basic philosophy is the stronger the "FEAR" sentiment, the more the SPY's proportion of the portfolio is, and the stronger the "Greed" sentiment, the less the SPY's share.
Rating Lower Upper Position
Extreme Fear 0 25 100%
Fear 25 45 70%
Neutral 45 55 50%
Greed 55 75 30%
Extreme Greed 75 100 0%

After the trading strategy is applied, the portfolio weight of SPY ETF is as shown in the chart below.

Fear-and-Greed index, SPY ETF Price, ETF's simulated position(%)

Backtesting results

After calculating the daily return of the simulated portfolio("daily_ret_strategy" column), I compared the cumulative performance of it with the cumulative performance of the spy ETF (Benchmark) in period of 2021-02-01 ~ 2023-02-09.
The performance was quite similar during the 2021-02-01 ~ end of 2021(Bull market period) but the simulated portfolio showed excess performance with +20% cumulative return in 2022.
It is also meaningful to compare the performance with indicators such as Sharp Ratio and Maximum Drawdown, so you can practice individually in Google Spreadsheet.

Cumulative return of the strategy (vs SPY ETF 100% benchmark)

Wrap-up

If you use the CNN-Fear-and-Greed Index to adjust the risky asset position in your portfolio, it will not be difficult to outperform the market in the long run ๐Ÿ˜Ž
In my case, I simulated with Google Spreadsheet, but It is also possible to run backtest through Python code, so please try it.
I'll finish my posting with Warren Buffett's best quote. Hope you make a lot of money~!

โ€œBe Fearful When Others Are Greedy and Greedy When Others Arre Fearfulโ€ -Warren buffett