Cointegration
A statistical relationship where two time series share a long-run equilibrium — even if they wander apart short-term, they tend to revert to a stable relationship.
See Cointegration in real trade signals
Tradewink uses cointegration as part of its AI signal pipeline. Get signals with full analysis — free to start.
Explained Simply
Two stocks are cointegrated if their price ratio or spread is stationary (mean-reverting) even though each individual stock's price is non-stationary (can trend). This is the mathematical foundation of pairs trading. Cointegration is tested using the Engle-Granger or Johansen test. A lower p-value (below 0.05) means stronger cointegration. The concept is different from correlation: two stocks can be correlated without being cointegrated.
Cointegration vs. Correlation: A Critical Distinction
Traders often confuse cointegration with correlation, but they measure fundamentally different things. Correlation measures how two assets move together at a single point in time — two stocks can be highly correlated for a period, then decouple completely. Cointegration, by contrast, tests whether a linear combination of two non-stationary price series produces a stationary series over the long run. Two cointegrated assets may diverge substantially over days or weeks, but their spread (or price ratio) reliably reverts to a mean. This long-run equilibrium relationship is the mathematical prerequisite for pairs trading. Without cointegration, a mean-reversion trade on a diverging pair has no statistical reason to close — making it speculation rather than a quantified edge.
The Engle-Granger and Johansen Tests
The two primary tests for cointegration are the Engle-Granger two-step procedure and the Johansen test. Engle-Granger is simpler: regress one price series on the other, then test the residuals for stationarity using an ADF (Augmented Dickey-Fuller) test. If residuals are stationary (ADF p-value below 0.05), the pair is cointegrated. The Johansen test is more powerful and can detect multiple cointegrating relationships among several assets simultaneously, making it suitable for basket trades. Both tests require a sufficient data history — typically two to five years of daily prices — to achieve reliable statistical power. Results should be validated on out-of-sample data to avoid overfitting to historical noise.
Half-Life and Mean-Reversion Speed
Knowing that a spread is cointegrated is not enough to trade it profitably — you also need to know how fast it mean-reverts. Half-life, derived from the Ornstein-Uhlenbeck process, estimates how many days it takes for a deviation to close by 50%. A half-life of 3 days requires frequent monitoring and rapid entry/exit; a half-life of 60 days ties up capital for extended periods. Most active pairs traders target half-lives of 5 to 30 days as a practical sweet spot. When cointegration is strong but half-life is too slow, the opportunity cost of capital outweighs the statistical edge. Educational note: these calculations are for informational purposes — actual trade profitability depends on execution costs, regime changes, and risk management.
Cointegration Breakdown Risk
Cointegration is not permanent. Corporate events such as mergers, spinoffs, major capital structure changes, or regulatory shifts can destroy the long-run equilibrium that once linked two assets. Sector rotation and macroeconomic regime changes can also weaken formerly strong cointegration relationships. Robust pairs trading systems continuously re-test cointegration on rolling windows and remove pairs whose p-values have degraded. When the spread widens beyond three or four standard deviations and does not show signs of reversion within the expected half-life, a prudent risk management rule is to exit the position, treating the breakdown as a stop-loss event rather than a deeper opportunity.
Practical Applications Beyond Pairs Trading
While pairs trading is the most common application, cointegration has broader uses in quantitative finance. Index arbitrageurs test cointegration between ETFs and their underlying baskets to identify temporary NAV dislocations. Fixed-income traders apply cointegration to yield-spread strategies across bonds of similar credit quality but different maturities. Crypto quant funds use cointegration between spot and perpetual futures to run funding-rate-neutral strategies. Factor investors test whether factor spreads (value vs. growth, for example) are cointegrated to determine if factor tilts will eventually revert to long-run equilibria. In all these contexts, the underlying logic is the same: find a statistically reliable long-run relationship and trade the short-term deviations.
How to Use Cointegration
- 1
Select Candidate Pairs
Choose pairs of stocks from the same sector that you believe are fundamentally linked — for example, Coca-Cola and PepsiCo, or Bank of America and JPMorgan. Same-sector pairs are more likely to be cointegrated.
- 2
Run the Cointegration Test
Use the Engle-Granger test or Johansen test in Python (statsmodels library) or R. The test checks whether a linear combination of the two price series is stationary. A p-value below 0.05 indicates the pair is cointegrated.
- 3
Calculate the Spread
Regress one stock's price against the other to find the hedge ratio. The spread = Stock A price - (hedge ratio × Stock B price). A stationary spread means it reverts to its mean — this is the basis for pairs trading.
- 4
Define Entry and Exit Rules
Calculate the spread's mean and standard deviation. Enter a trade when the spread moves 2+ standard deviations from the mean (long the underperformer, short the outperformer). Exit when the spread returns to the mean.
- 5
Monitor for Cointegration Breakdown
Re-run the cointegration test monthly. Structural changes (mergers, regulatory shifts, business model divergence) can break the cointegration relationship permanently. If the test fails, close the position and remove the pair from your universe.
Frequently Asked Questions
What does it mean for two stocks to be cointegrated?
Two stocks are cointegrated when a linear combination of their price series — most commonly the spread or ratio — is stationary, meaning it fluctuates around a stable mean rather than drifting indefinitely. This implies a persistent economic or structural link between the two companies: they may share a common industry cost structure, compete in the same market, or be related through supply chains. Even when each individual stock price follows a random walk (non-stationary), the cointegrated pair maintains a long-run equilibrium, making the spread predictably mean-reverting and tradeable.
How is cointegration tested, and what p-value is acceptable?
The Engle-Granger test regresses one price series on the other and applies an Augmented Dickey-Fuller test to the residuals. A p-value below 0.05 is the standard threshold for cointegration, indicating less than a 5% probability the result is spurious. More conservative practitioners require p-values below 0.01, particularly when screening hundreds of pairs — multiple-testing bias inflates the chance of finding false positives. The Johansen test is an alternative that handles multivariate cointegration. Both tests should be run on sufficient historical data (at least two years daily) and validated on a hold-out sample before trading.
Can cointegration break down, and how should traders handle it?
Yes. Cointegration can break down when fundamental changes disrupt the relationship — mergers, regulatory events, competitive shifts, or broad market regime transitions. Traders handle breakdown risk by continuously monitoring the spread's behavior on rolling windows, re-testing cointegration periodically, and establishing hard stop-loss rules when the spread exceeds three to four standard deviations without reverting within the expected half-life. Treating a cointegration breakdown as an exit signal rather than an opportunity to add to the position is a critical risk-management discipline. The ability to recognize relationship breakdown early is what separates robust pairs trading from a strategy that eventually suffers a catastrophic loss.
Is cointegration the same as correlation?
No. Correlation is a static snapshot of how two variables co-move at a given time and can change rapidly. Cointegration is a long-run structural property — two assets may have low day-to-day correlation but remain strongly cointegrated because their prices are anchored to a common long-term equilibrium. Conversely, two highly correlated assets (both trending upward in a bull market) may not be cointegrated at all because their spread is non-stationary and continuously expanding. For pairs trading purposes, cointegration is the more meaningful metric because it provides the statistical guarantee that spread deviations will eventually close.
How Tradewink Uses Cointegration
Our PairsTrader module tests cointegration across 1,000+ potential stock pairs using the Engle-Granger method. Pairs with p-value <0.05 and favorable half-life (5-30 days) qualify for pairs trade signals. The AI also monitors cointegration stability over rolling windows — if cointegration breaks down, the pair is removed from the active signal universe.
Trading Insights Newsletter
Weekly deep-dives on strategy, signals, and market structure — written for active traders. No spam, unsubscribe anytime.
Related Terms
Previous
Kelly Criterion
Next
Mean Reversion
See Cointegration in real trade signals
Tradewink uses cointegration as part of its AI signal pipeline. Get daily trade ideas with full analysis — free to start.