All indicators

Augmented Dickey–Fuller (ADF) mean reversion test

Oct 29, 2021

Static chart image
Dashboard

The Augmented Dickey–Fuller (ADF) mean reversion test indicator provides a statistical measure to determine if a price series sample has a tendency to mean revert rather than follow a random walk. By analyzing the proportionality of price changes relative to the mean, this tool helps traders identify potential market inefficiencies where mean-reversion strategies may be applicable.

Usage

The Usage section focuses on interpreting the ADF test statistic in relation to its critical values. The tool is designed to be used on any timeframe and asset class to assess the current market regime.

  • Mean Reversion Identification: When the plotted test statistic is lower (more negative) than the blue critical value line, the hypothesis of mean reversion is accepted at the chosen confidence level.
  • Momentum/Trending Identification: If the test statistic remains above the critical value or becomes positive, the asset is likely in a trending phase or exhibiting momentum, suggesting that mean-reversion strategies should be avoided.
  • Market Context: For example, mean-reverting assets like the VIX often show the ADF statistic consistently below the 90% confidence threshold, whereas trending assets like BTCUSD often stay above it.
  • Visual Aids: The indicator features a dynamic color-coded plot and an optional infobox that displays the current test statistic, critical value, and a "Yes/No" status for mean reversion.

Details

The Augmented Dickey-Fuller test is a formal statistical test for a unit root in an autoregressive process. In this implementation, the model accounts for a non-zero constant and zero time trend.

Mathematically, the script estimates a proportionality constant via linear regression. If this constant is significantly different from zero, the series is considered stationary (mean-reverting). The test statistic is calculated by dividing the estimated constant by its standard error. Critical values are dynamically calculated based on the MacKinnon (2010) distribution, which accounts for the sample size (Length).

Settings

Main Settings

  • Source: The price data point used for calculation (e.g., Close).
  • Length: The number of bars in the rolling lookback window. A larger length increases the reliability of the statistical test.
  • Maximum lag: Defines the order of the autoregressive process. Setting this to 0 represents a simple AR(1) process, while higher values account for serial correlation in price changes.
  • Confidence Level: The probability threshold (90%, 95%, or 99%) used to determine the critical value.
  • Show Infobox: Toggles the visibility of the summary table on the chart.

FAQ

How do I interpret the ADF test statistic?

The more negative the value, the stronger the evidence for mean reversion. If it is below the blue critical value line, the market is statistically likely to be in a mean-reverting phase.

Does a mean-reverting signal predict the next price direction?

No, the ADF test indicates the nature of the price action (stationary vs. non-stationary) rather than a specific directional bias. It suggests whether a counter-trend strategy is statistically viable.

How can I access Augmented Dickey–Fuller (ADF) mean reversion test?

You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.