Skip to content
All library documents

Cointegration Tests for Stock Portfolios and the Risks of Fast Pairs Trading

Article MQL5 articles

Summary

This article introduces cointegration as a way to identify long-run relationships among stocks for statistical arbitrage, moving beyond simple correlation and two-asset pairs. It describes applying the Engle-Granger test to a pair and the Johansen method to groups of instruments, alongside a stationarity check for the resulting spread. The accompanying notebooks are presented as practical tools for running these analyses and managing historical quote data.

A central lesson comes from a correlation-based gold pairs strategy that looked promising in a backtest but performed badly during a two-week demo run, including a long run of consecutive losses. The author attributes the failure mainly to execution timing: simulated network delays also damaged the results, while spreads were considered a less likely cause. Cointegration may provide a stronger statistical framework, but it does not guarantee a stable relationship or profitable trades. The article stresses that arbitrage is not risk-free and that data quality, execution speed, and risk management matter; the available computing and infrastructure may constrain retail implementations.

Key ideas

  • Correlation captures co-movement but does not establish a stable long-run relationship between assets.
  • Engle-Granger testing can examine cointegration for a pair, while Johansen testing can handle a group of instruments.
  • A backtest that looked successful failed in a short demo run, illustrating the gap between simulated and live execution.
  • Simulated network delays materially worsened the example strategy, pointing to timing as a major vulnerability.
  • Cointegration-based arbitrage still carries risk and depends on sound data, execution, and risk controls.

Tags

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