Pairs trading & cointegration
≈commoditisedThe simplest stat arb: find two cointegrated names, and when their spread diverges, short the rich and buy the cheap, betting on reversion. The z-score triggers entry and exit. Competed away in liquid equities; a clean teaching case everywhere.
See it move
What to notice. The spread between two cointegrated names is stationary: it wanders but reverts. Trade it when it's stretched past ±2.0σ and exit at the mean. Tighten the threshold for more round-trips and more cost; widen it for fewer, cleaner ones.
What is a pairs trade?
A pairs trade is a market-neutral position: long one instrument, short a related one, sized so the combination is a mean-reverting spread. You profit when the spread closes (the relatively cheap leg catches up and the relatively rich leg falls back) regardless of which way the market moves. It is the simplest, most famous instance of statistical arbitrage.
Intuition first. Pick two names that move together for a real reason: two airlines, two payment networks, an ETF and a near-substitute. When one drifts cheap relative to the other with no fundamental cause, you buy the cheap one and short the rich one. When they re-converge you unwind, pocketing the gap. Because you are long and short, a market-wide move cancels; you only care about the relative move, not the level of the market.
The position is unit of A and units of B, where is the hedge ratio that makes the combination market-neutral and the spread stationary. The strategy is attributed to Nunzio Tartaglia's quant group at Morgan Stanley in the mid-1980s; the academic reference point is Gatev, Goetzmann & Rouwenhorst (2006), who documented the distance-based version's historical returns and their subsequent decay.
Correlation is not enough: you need cointegration
Correlation measures whether two series move together period to period; it can be high by coincidence with no force pulling them back together. Cointegration is stronger: a linear combination of the two price levels is stationary: it has a fixed mean it reverts to. Pairs trading needs cointegration, because only a stationary spread is reliably mean-reverting.
The trap is the spurious regression (Granger & Newbold 1974): two independent random walks can show high rolling correlation over a sample purely by chance. Trade their "spread" and you are trading noise with no reversion: it drifts off and never comes back. Correlation of returns says nothing about whether the price levels stay tethered. That is the single most important thing to internalise on this page.
Cointegration (Engle & Granger 1987) is the property you actually want: two non-stationary series , (each a random walk, integrated of order one, ) are cointegrated if some combination is stationary (): it fluctuates around a constant mean and reverts. That stationary combination is your tradable spread. The economic story is a shared stochastic trend (the common factor) plus a mean-reverting deviation.
The standard, simplest test is the Engle–Granger two-step. First, estimate the cointegrating relationship by OLS: regress on to get the hedge ratio and the residual . Second, test that residual for stationarity with an Augmented Dickey–Fuller (ADF) test: if you reject the unit-root null, the residual is stationary, the pair is cointegrated, and is your spread. Three caveats stated plainly. The test is in-sample and direction-dependent (regressing A on B versus B on A gives slightly different ); the Johansen test handles multiple series and is symmetric; and multiple-testing kills you: scan 5,000 pairs at and roughly 250 pass by chance. Out-of-sample re-validation and an economic prior for why the pair should cointegrate are non-negotiable (see backtesting & simulation).
▸ Show the derivation: Engle–Granger and the stationary spread optional
Let each price be a random walk with a unit root, so the change is stationary but the level is not. They are cointegrated if a weighting makes the residual stationary.
The Granger Representation Theorem then guarantees an error-correction model: when the spread is positive (A rich), A's expected change is negative, pulling the spread back. The negative loading on last period's spread is the mathematical statement of "the spread reverts".
Step 1 estimates by OLS, super-consistent under cointegration. Step 2 runs ADF on the estimated residual: regress its change on its lag plus lagged differences, and test the unit-root null against a negative root.
Crucially, use the Engle–Granger critical values, not the standard ADF ones, because the residual is estimated, which shifts the test's distribution. Skip this and you will reject the null too readily and trade spurious pairs.
The spread, the hedge ratio and the z-score: entry and exit
Once you have a stationary spread, you standardise it into a z-score: how many standard deviations the spread sits from its rolling mean. You enter when is large (the spread is far from fair) and exit as returns toward zero. The z-score turns "how mispriced" into a tradable signal that is comparable across pairs and across time.
The hedge ratio is the OLS slope from the cointegrating regression: how many units of B offset one unit of A so the combination is neutral. It must be re-estimated on a rolling basis; a drifting is an early warning that the relationship is changing under you.
The typical rules follow directly. Enter short the spread (sell A, buy units of B) when , say . Enter long the spread (buy A, sell units of B) when . Exit when crosses back through (often zero, sometimes ) taking the reversion. And stop when (say 3 to 4) because the spread is not reverting, and you cut before it becomes a regime break.
The threshold trade-off is the heart of the design. A wider entry band () means fewer, larger, higher-conviction trades but rarer signals and longer holds; a narrower band () means more, smaller trades that more easily fail to clear costs. The optimum depends on the half-life, the spread volatility, and round-trip costs on both legs: push down to chase more trades and you destroy net P&L once costs bite.
The half-life: how fast does the spread revert? (Ornstein–Uhlenbeck)
The half-life is the expected time for a deviation to shrink by half: your holding period and your capital-turnover. Model the spread as an Ornstein–Uhlenbeck process (continuous-time mean reversion), fit its speed , and the half-life is . A half-life of hours means fast intraday turnover; weeks means slow turnover and more exposure to a regime break.
Intuition: the spread is a spring. The stiffer the spring (the faster the mean reversion) the quicker a stretched spread snaps back. The half-life puts a number on "how quickly", and so tells you how long your capital is tied up per trade and how many independent bets you get per year.
Fitting it is a one-line regression. Discretise the OU process to an AR(1) form, ; then and . A more negative means faster reversion and a shorter half-life. This is the same regression as the ADF test: stationarity and reversion speed are two readings of one fit. Why it gates profitability: each round-trip captures roughly the spread's standard deviation, and you get about one independent bet per half-life, so annual gross is roughly bets-per-year times the per-bet sigma. A 3-day half-life on a sigma that clears costs is tradable; a 6-week half-life means about eight bets a year and heavy exposure to the relationship breaking mid-trade.
▸ Show the derivation: OU half-life from the discrete fit optional
The OU SDE has an exact discrete solution: the next value is a weighted blend of the long-run mean and the current value, with the weight on the current value an exponential decay, plus mean-zero noise.
Match this to the AR(1) regression . The autoregressive coefficient is exactly the decay factor, so the speed falls straight out as a log.
A deviation decays as ; set that equal to one half and solve for the half-life. In practice fit the difference form (so ); for small , the speed is approximately .
What kills a pairs trade? Regime break and crowding
Two things kill it. A regime break: the cointegrating relationship stops holding (a merger, a sector shock, a constituent change) and the spread diverges instead of reverting, blowing through your stop. And crowding: so many traders chase the same spread that deviations shrink below costs. Both are why relative-value P&L is negatively skewed: many small wins, occasional large losses.
Regime break is the tail risk. Cointegration is an estimated, historical property, not a law. When the economic link changes (one airline gets acquired, a payment network loses a partner, an index reconstitutes) the spread that always reverted now trends. Your z-score keeps screaming "enter" as you bleed. This is why a hard stop and a rolling re-test of cointegration are mandatory, and why position sizing must survive the spread not reverting.
Crowding is alpha decay. A public spread attracts capital; capital arbitrages deviations faster and smaller (see capacity & alpha decay). The gross deviation you could once capture shrinks until it no longer clears round-trip costs on both legs, which is precisely why the classic equity pairs trade is dead in liquid names. Layered on top is cost asymmetry: every trade pays the spread, fees and market impact on two legs, twice (in and out), and shorting adds borrow cost and recall risk. A spread that looks profitable gross is routinely unprofitable net; costs are the first thing to model, not the last.
The canonical case is the August 2007 "quant quake" (Khandani & Lo 2007): crowded equity-neutral books all delevered into the same names at once, and supposedly diversified, market-neutral portfolios took correlated, double-digit losses in days. The lesson is that your real risk is not any single pair but the population of traders holding your pairs.
Worked example
A pairs trade on a synthetic cointegrated pair, as of 2026, with illustrative numbers. The cointegrating regression gives hedge ratio and intercept near zero, so the spread is . Over the 60-day fit window the spread has mean and standard deviation . The AR(1) fit gives per day, so per day and the half-life is days. Rules: enter at , exit at , stop at .
The good trade. The spread widens to , so . You sell 1 A and buy 0.8 B, shorting the spread. Three days later (one half-life) the spread reverts to (); you unwind. Gross is about per unit of spread, market-neutral throughout.
The bad case. Instead of reverting, the spread keeps widening to () and the stop fires for a loss of about gross plus costs. A subsequent re-test shows the ADF residual is no longer stationary: the relationship broke (a corporate action on B). The correct behaviour is to stop trading the pair, not "average down": the negative skew lives exactly here, and adding to a broken spread is how a small loss becomes a blow-up. The live IX-COINT explorer above lets you set , , the reversion speed and the z-bands and read the half-life and net P&L directly. Real hedge ratios, volatilities, half-lives and costs must be measured per pair and dated. These figures are synthetic, educational only, and not investment advice.