blog · ~6 min read

Correlation and Cointegration in Pairs Trading

Distinguish correlation from cointegration for pairs trading, run the Engle-Granger test, estimate half-life, and build a mean-reverting spread with entry rules.

T By tradernewbie · Curated for beginners
#statistics#quantitative
Эта статья на английском. Открыть на вашем языке? Google Translate →

Интерактивные инструменты могут не работать в переведённом виде.

Correlation and Cointegration in Pairs Trading

Pairs trading requires cointegration, not correlation. Confusing the two blows up pairs strategies: correlated pairs diverge permanently and the position never reverts.

Correlation vs Cointegration

  • Correlation: two series move together over short horizons. It is scale-dependent and unstable; a highly correlated pair can still drift apart over time.
  • Cointegration: two series share a long-run equilibrium. Their spread is stationary and reverts to a mean, which makes a pair tradable.

A pair can be correlated but not cointegrated (two stocks rising together, then one goes bankrupt). A pair can be cointegrated yet weakly correlated over short windows. For pairs trading, demand cointegration.

The Engle-Granger Test

  1. Run an ordinary least squares regression: Y = α + βX + ε.
  2. Test the residuals ε for a unit root using the Augmented Dickey-Fuller (ADF) test.
  3. If the ADF test rejects the unit root (p-value below 0.05), the residuals are stationary and the pair is cointegrated.

Use the β from the regression as the hedge ratio. The spread is S = Y − βX. Trade the spread when it deviates from its mean.

Half-Life of Mean Reversion

Estimate the half-life, how long a deviation takes to decay by half:

ΔS_t = α + λ·S_{t-1} + ε_t

Half-life = −ln(2) / ln(1 + λ)

A half-life of 5-20 days is tradable for daily pairs. Below 3 days the spread reverts before you can position; above 40 days the capital tie-up and carry cost erode the edge.

Building the Trade

  • Spread mean and standard deviation: compute on a rolling 250-day window.
  • Entry: go long the spread (buy Y, sell β of X) when S falls below mean − 2σ. Go short the spread when S rises above mean + 2σ.
  • Exit: close at the mean, not at a fixed profit. The mean is the equilibrium.
  • Stop: close if the spread exceeds mean ± 3.5σ, the cointegration has likely broken.
  • Re-test cointegration monthly. Pairs stop cointegrating; the relationship is not permanent.

Sizing

Size each leg by the hedge ratio β, not equal dollars. If β = 0.6, hold $0.60 of X per $1.00 of Y. Dollar-neutral is not beta-neutral; the regression β is the correct neutralizer.

Common Failures

  • Trading correlation: a pair picked for high correlation without a cointegration test drifts apart and the loss grows.
  • Static hedge ratio: β shifts; re-estimate monthly on a rolling window.
  • Structural breaks: mergers, rotation, or regulation break cointegration abruptly. The 3.5σ stop exists for these.
  • Overfitting the window: a 60-day test passes spurious pairs. Use 250+ days and out-of-sample confirmation.

The Discipline

Cointegration is a statistical claim about the past, not a guarantee about the future. Test it, estimate the half-life, trade the spread with defined entries and a structural-break stop, and re-test regularly. The edge is real but fragile, and dies the moment you treat a past relationship as permanent.

Related market data, powered by TradingView.

Educational content · Not financial advice · Trade at your own risk