Skip to content
All library documents

Implementing the Augmented Dickey-Fuller Test for Cointegration

Article MQL5 articles

Summary

This article explains the Augmented Dickey-Fuller test as a way to assess whether a series has a unit root, with stationarity as the alternative. It describes the regression behind the test, the role of the coefficient on the lagged series, and how the statistic is compared with critical values. The method can help assess whether transformations made a series stationary and is also used in cointegration analysis.

The implementation in MQL5 is organized around ordinary least squares estimation, information criteria for choosing an autoregressive specification, MacKinnon approximations for p-values, and critical values. The article compares its implementation with Python's statsmodels routine, then applies the test within an Engle-Granger cointegration workflow to examine symbol pairs in MetaTrader 5. Example output labels some pairs as likely cointegrated and others as not likely. These are sample findings, not evidence of a durable trading edge; the article notes the test's usefulness for exploring pairs trading and statistical arbitrage, where conclusions remain subject to sampling uncertainty.

Key ideas

  • The ADF test evaluates a unit-root null hypothesis against an alternative of stationarity.
  • Its regression uses the coefficient on the lagged level, with the test statistic compared against critical values.
  • The MQL5 implementation combines OLS estimation, model criteria, and MacKinnon approximations for inference.
  • The article uses the test as part of an Engle-Granger procedure to assess cointegration between symbols.
  • Cointegration test outcomes are sample-based evidence and do not by themselves establish a profitable strategy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.