Trading the Fear and Greed Index (Patreon)
Downloads
Content
Introduction
I am currently working hard on another side project for my audience, that I will keep secret for now. But during the preparations for that project I got a trading Idea that looked very interesting to me to build on further. So in this video I will present you the findings of that experiment.
The premise of this trading idea is that the Crypto Fear and Greed index can be an indicator that can supply you with signals for entering and exiting the market.
For those of you who that do now know what the fear and greed index is. It is a lagging indicator. This index is also made up of several other parameters like volatility, volume, social media analysis, trend information and other data. And you can find this indicator on this page: Crypto Fear & Greed Index - Bitcoin Sentiment - Alternative.me
The whole idea of my strategy is based on this Fear and Greed index. And since this indicator is built from other information, you should be aware that this is a lagging indicator and mostly fit for higher timeframes and trend trading.
The index is low when markets are very bearish and contain a lot of fear. But the indicator can also measure high values when markets are parabolic and bullish and everybody gets greedy. In other words the indicator shifts between fear and greed.
So I thought to myself, “Why not use the F&G index to determine my investment or trading decisions?”
And this is exactly what I want to present in this video, a test to find out if this could be a good indicator for trading, or at least if it could be some sort of baseline that you can combine with other entry or exit signals.
So I started up my Jupyter notebook and my trusty programming companion ChatGPT. And I started to code to see if I could make something that I could use with the automated backtesting engine. This way I can use my testing dataset and can also compare the results with all the other algorithms I already have tested. You have to have some sort of baseline to compare the results with is my modest opinion.
The strategy
As you already might know you can go absolutely crazy with all kinds of parameters and confirmation indicators. But I deliberately kept the strategy super simple here. That would at least give some information that I am onto something special here. You can always build further on this base algorithm and try to squeeze the maximum out of the backtest data. But then you will introduce curve fitting bias and that might lead to disappointing future results when you are actually trading.
My strategy rules are therefore as follows:
The scale of the Fear and Greed index goes from 0 to 100. So to enter the market, the Fear and Greed index should be at 50 or above.
Or in other words, the markets should be at least above the neutral boundary.To determine if the Index is going upwards or downwards I will make use of a 100 period simple moving average over the same Fear and Greed index. 100 is arbitrarily chosen. I could have chosen 50 or 200 or Hyperoptimized the best setting. But this is a nice simple number and a baseline for further development. No special meanings.
Anyway, if the index is above its moving average it is upwards moving and if it is below its moving average it is going down. And thus for the second signal the F&G index should be above its 100 period moving average.
There are also some exit signals.
The main exit signal is when the Fear and Greed index is below the 100 period moving average. This way I know that the index is going lower and people start to get more fear. Great exit signal I would say.
Other exit signals are the stop loss, which is set so sell at 25 percent loss. Giving the trade enough breathing room I hope.
And the other exit signal is set if I have 1000 percent profit. Mostly to disable the ROI setting of the backtesting engine. But it could well be that coins have a 1000 percent gain. Which flows directly into my trading account at that moment.
Some code
I will spare you the complete process of my code writing but will only show you the most important parts of the code that I used for testing.
The information for the fear and greed index does not come from the candlestick information I usually use with these backtests. But Instead I have to download this data from the alternative.me site API. The function that downloads the data then also has to process that data so that it matches that of the dataframe that is used in the backtesting engine.
When the actual indicators are called, the fear and greed function is used to get the data and then merge it into the dataframe that is used to determine the trading signals.
Once everything is added nicely to the dataframe the actual entry and exit signals are configured in the populate entry and exit trend.
So you see it’s a super easy trading strategy. And in other words an interesting experiment with absolutely no guarantees but lots of fun to make. Let’s start the real test to see if I’m on the correct path and see the results later (after this shameless plug).
Backtest results
As I expected, the daily timeframe seems to have the best cards in hand. With a win percentage of 2440 it looks like we have a reasonable foundation in hands to build on further. The win percentage of trades is slightly below 50 percent and with a maximum drawdown of around 22 percent losses are still manageable. The Sharpe ratio however is on the low side and only 33 percent of the pairs seem to like this way of trading. Which is also not too optimistic.
The pairs that have profits under my specific circumstances are the following:
I assume that the reason why there are so much pairs that did not even open a trade is because my settings only allow 10 open positions at the same time. So if after the signal that the Fear and greed index is above 50 and its moving average, then all positions will be opened immediately. Because I do not use the individual data of pairs in this algorithm. That might be a negative aspect of the current setup. But more refinement can be added by adding extra signals that look into each individual pair data.
Another thing what I also did is to configure my trading bot to open a position for each pair. This way the strategy opens a position for every pair configured and there are no missed opportunities if other pairs might perform better. I just hypothetically trade them all if I get Fear and Greed signals.
In this case I have to configure the bot’s settings to allow a maximum of 50 trades open at the same time. I also gave it 10 times more funds to that there was money to trade with.
Now please do not look at the end balance here because I have completely deviated from my standard way of testing. And take this as input for further investigation and no advice whatsoever.
Since this is more an indication of the workings of this baseline indicator for starting to trade on.
It also gives insights to the answer of the question about when to actually start your trading bot.
For trading it is not only the time in the market that’s important but also timing when to enter the market. You would not be the fist one that bought crypto at the top of the last bull cycle because you timed wrongly.
And it would be a painful experience to see your investments losing 50 percent of its initial worth. So the timing to start trading by hand or starting a trading bot is certainly a good question and these test results might give an answer to that.
Now Trading both long and short should theoretically be the better option here. But this ability also depends on where you live at the moment and the regulations you have to comply with.
Anyway, considering that this is more of a try out instead of a serious backtest that you are used from me. I will only show you briefly the plots with comparisons against the best scoring trading strategies during my final thoughts.
Endings and looking back
Let’s wrap this post up with my cautious conclusion that The Fear and Greed Index could be a good baseline indicator on which you can build the rest of your trading strategy on.
It looks to be a tool that can help you determine if markets are ready to step in for longer term investment or for spot trading for long positions.
You could also do the reverse for when you want to trade on fear and go short when the Index indicates this.
But I didn’t test this out since I am limited in possibilities due to my countries regulations. However you are always welcome to test this out and add your findings to the comments section below.
As I said in the beginning of this post. This was more of a rough trading Idea that I wanted to show you.
Since this indicator is not bound to a certain pair it’s probably a good idea to add some other indicators or rules to the strategy. For example, you can add the EMA 50 and open trades when the price is above this line. Or add the RSI indicator and add some market strength to the equation where you only trade if it is above 50 or 55. The possibilities are limitless here and it’s only your own imagination that holds you back developing a good trading or investment strategy.
Or you can just YOLO into all your favorite coins at the moment the indicator flips to greed.
In any case, Just remember to do your own research, backtest and forward test for enough time before starting to do actual trading this strategy.
For now I think I have enough information about this idea and will quickly go further with my other project.
See you in the next post,
Goodbye!