Mean Reversion with ADF Test – What is an ADF test? (Meaning & Definition)

Mean reversion strategies come with their own set of advantages and disadvantages relative to trend-following strategies. However, just as when implementing a trend-following strategy, knowing the statistical behavior of your asset is of vital importance when it comes to mean reversion strategies. There are indicators and statistical tools to evaluate the mean reversion properties of an asset. Can we use for example the Augmented Dickey-Fuller (ADF) Test to find a mean reversion strategy for Cocoa futures?

Our backtests reveal that we manage to create a specific Cocoa trading strategy based on the Augmented Dickey-Fuller (ADF) Test.

Let’s show you what we did and how we utilized the Augmented Dickey-Fuller (ADF) Test to make specific trading rules for Cocoa futures:

Statistical behavior and importance of asset knowledge

Not all assets tend to mean revert over time. In fact, most do not, and applying a mean reversion strategy to an asset which tends to produce long-lasting trends is a fast way to financial ruin, no matter how sound your strategy is in principle.

So, how do we figure out which assets are mean reverting, and which are not? One potential answer lies in the Augmented Dickey-Fuller (ADF) Test.

The Augmented Dickey-Fuller (ADF) test for mean reversion

The role of the ADF test in this context is to consider a hypothesis (the null hypothesis), which, if true, would indicate that the price movement over a given time series has a unit root, implying a ‘random walk’, which is the opposite of mean reversion.

By examining the relationship between the current price of the time series and its previous values, the ADF-test then attempts to disprove the null hypothesis with a degree of certainty. Through this process, the ADF test can thus tell us within a certain confidence level whether the price movement of an asset over a given time series is more likely to be random or more likely to be mean reverting.

Implementing the ADF Test

There is some relatively complex mathematics underlying the ADF test, which we won’t go into here, but as with most trading indicators, it can be calculated through an indicator on a trading platform such as TradingView.

Importing the ADF indicator, setting it to 1000 periods on the daily time frame with a 90% confidence level allows us to reveal some interesting results about which assets tend to mean revert.

Results of the mean reversion test for AAPL and S&P 500 stocks

The first fact that will become readily apparent is that most assets, as previously stated, do not mean revert over longer timeframes spanning several years.

Browsing through stocks in the S&P 500 reveals few examples of stocks which mean revert consistently during such a long time frame. Below are the ADF indicator readings for AAPL over the last 1000 trading days as an example:

The Augmented Dickey-Fuller (ADF) test for mean reversion

Applying a mean reversion strategy to trending growth stocks:

From this, we can reasonably assume that applying any mean reversion strategy to historically trending growth stocks, e.g. AAPL, would likely lead to incurring losses if these stocks continue their growth into the future, at least for long time frames.

Conversely, stocks that show signs of not being mean reverting with a high degree of certainty might be considered potential candidates for trend-following strategies, given further backtesting and research.

Considerations for Different Asset Classes

The rest of this article will mostly focus on commodities.

If you go looking for mean reversion in cryptocurrencies, please be aware of crypto market cycles, which have historically caused cryptocurrencies to trend strongly in shorter phases, followed by longer phases of relative mean reversion as each bull cycle dies down. You do not want to be in a mean reversal strategy on Bitcoin during a crypto bull cycle.

Mean Reversion in Commodities

Let’s move over to commodities, and investigate gold futures, while also closely examining the ADF indicator itself.

ADF test for gold

Gold Futures and the ADF Indicator

The second important fact that reveals itself when looking at the ADF indicator is that assets are not inherently mean reverting or trending all the time, but go through phases of mean reversion, showing up as time spent below the purple line, where the price during the last 1000 periods is more than 90% likely to have been mean reverting.

Conversely, assets also go through phases of random walks, where they trend strongly, and the price detaches from previous price points, often moving into what is for good reason called “price discovery”.

Challenges in Commodity Mean Reversion Strategies

This means that gold, which we would perhaps expect to be inherently mean reverting, seeing as it has historically been a relatively stable asset, goes through long phases where it shows few signs of being so.

Even if you manage to catch it at a time where price has likely been mean reverting for the last 1000 periods (similar to the current situation in gold prices), and start implementing your mean reversion strategy from here, gold is likely to shift into a trending phase before significant time has passed.

Finding a Good Asset: Cocoa Futures

Scanning through the world of commodities using the ADF indicator reveals many similar results. Silver looks better than gold, and platinum looks better still, but all the metals spend most of their time at less than 90% confidence level of being mean reverting, and also come with powerful bull and bear cycles which lead into short-term tops and bottoms that could tear any mean reversion strategy apart.

It is important to consider that due to the nature of mean reversion strategies, you would likely only have a “black swan stop-loss” far away from current price, rather than the usual tight stop-loss you would use when using a trend-following strategy.

Mean Reversion Strategies in Cocoa Futures

We have previously published an article on trading Cocoa futures. Cocoa is known by word-of-mouth as a great target for mean reversion strategies in the world of commodities. Word-of-mouth is rarely a good indicator, but combined with the ADF indicator, we seem to have these rumors confirmed:

Cocoa trading strategy based on the ADF test

Trading strategy based on the ADF test: cocoa

As proof-of-concept, we will here be using a simple RSI-based strategy on the daily timeframe. Let’s look at the trading rules:

First, we apply the RSI indicator with a length of 3 on a daily time frame. We set the overbought condition at 80, and the oversold condition at 20. We also apply the EMA100 as a trend filter, which also defines the mean which we expect the price to move towards.

Then, on the daily timeframe, if the RSI indicator reaches an overbought condition, and price is above the EMA100, we enter a short position on the open of the next trading day.

When the RSI indicator has moved all the way from overbought to oversold (in a short position) or from oversold to overbought (in a long position) on the daily close, we exit our position on the next day’s open.

Conversely, if the RSI indicator reaches an oversold condition, and price is below the EMA100, we enter a long position on the open of the next trading day. We exit either position once the RSI indicator reaches the opposite condition on the daily close.

Thus, the trading rules are fairly simple and easy to understand.

Backtesting Results for the RSI-Based Strategy in Cocoa Futures (based on the ADF test)

We start backtesting from June 2016, catching the November 2016 to May 2018 phase, which we now know was the worst possible time to apply a mean reversion strategy in Cocoa.

Doing this is beneficial, as it provides us with realistic results, demonstrates what could happen if a sound strategy gets off to a bad start, and helps us psychologically prepare for potential real-time challenges when deploying this or any other strategy. Backtesting from June 2016 to April 2023 yields the following results:

ADF test backtest results and performance

Sticking with a Backtested Strategy Despite Drawdowns

As can be seen, our strategy starts off by meandering sideways before going into a significant drawdown. Not great for our finances, and definitely not great for our mental state.

At this point, nearly three years have passed since implementation, and most traders would likely have thrown in the towel at this point, abandoning the strategy. What happens next is that the punishing bull cycle ends, and Cocoa returns to mean reversion. This triggers a four-year phase where our strategy moves more or less smoothly into a +337.83% profit.

Importance of Diversification and Portfolio Approach

Few charts could better demonstrate the importance of sticking with a properly backtested strategy over time, even when it goes through phases of significant drawdown.

For strategies operating on higher timeframes, this sometimes means taking significant losses over a period of several years, before turning a profit. This is psychologically challenging, but thought exercises such as this one, even if you don’t end up implementing this exact strategy in Cocoa, helps lessen this mental burden by showing you what you need to be prepared for beforehand.

It also shows the importance of diversifying your trading through applying multiple uncorrelated strategies simultaneously, as doing so will reduce both the financial and emotional impact of any given strategy going through a drawdown phase.

Performance metrics and statistics for the Cocoa Mean Reversion Strategy based on the Augmented Dickey-Fuller (ADF) Test

If these precautions are followed, and this Cocoa mean reversion strategy is implemented as one part of a wider portfolio of trading strategies, it shows significant promise in the long run.

Its profit factor of 2.336 and win rate of 73.96% both look good. Moreover, it is unlikely to be curve-fitted, given the lack of optimization and simple trade rules setup, as well as a relatively decent number of trades (96) over which to average the results.

Trade execution for a manual trader should be quite time-efficient, only requiring the trader to check the relevant indicators some minutes before opening each day, and entering and exiting positions as needed. The hardest part will likely be to sit through the volatility and drawdowns. The low Sharpe ratio of 0.287 is a cause for concern, and even though this could likely be improved given further optimization, you would need to expect a lot of volatility going in. Consider automating your trading if implementing this or any other mean reversion strategy, in order to avoid decision fatigue.

Conclusion: ADF Test for Mean Reversion Strategies

In conclusion, the ADF test seems to work well for finding assets which mean revert over time. This specific RSI-strategy is merely used to prove this point, and there are probably mean reversal strategies out there which will work even better. This shows that using the ADF test to screen for assets where mean reversal strategies could be applied is not only yet another good idea, but a fundamental step which is vital to your trading success if you should choose to apply such strategies.


Why is it essential to know the statistical behavior of an asset for mean reversion strategies?

Mean reversion strategy involves buying or selling an asset based on the expectation that its price will return to a historical average or mean after deviating from it. Understanding the statistical behavior helps determine whether an asset tends to mean revert over time, which is crucial for the success of mean reversion strategies.

How is the ADF Test implemented in trading?

The ADF Test assesses whether a time series exhibits a unit root, indicating a random walk and the opposite of mean reversion. It helps traders identify assets suitable for mean reversion strategies. The ADF Test is often implemented as an indicator on trading platforms like TradingView. It examines the relationship between current and previous prices to determine the likelihood of mean reversion.

Why is Cocoa considered a good candidate for mean reversion strategies?

Cocoa is often considered a good candidate for mean reversion due to its historical behavior and characteristics that make it suitable for strategies like the one outlined in the article. Commodities, like gold, silver, and platinum, may go through phases of both mean reversion and strong trends. Identifying the right time for mean reversion strategies in commodities can be challenging.

Similar Posts