Skip to content
Finance Lessons

Systematic & Statistical Arbitrage

Pairs Trading & Cointegration

The original stat-arb trade: why correlation isn't enough, how cointegration makes a spread stationary, trading z-score bands at ±2σ, and reading half-life.

15 min Updated Jun 15, 2026

In the 1980s a quant team at Morgan Stanley noticed something almost too simple to be a strategy: when two near-identical stocks — say two soda giants, or two oil majors — drifted apart, they almost always snapped back together. So they built a rule. Buy the cheap one, short the expensive one, wait for the gap to close, pocket the difference, repeat. No view on the market, no view on whether stocks go up or down — just a bet that the distance between two things that belong together won’t stay stretched forever. That trade is pairs trading, and it is the ancestor of the entire statistical-arbitrage industry.

The whole game lives or dies on one question: when is a gap a real rubber band that will snap back, versus two ships that merely happened to sail near each other before drifting off to opposite oceans? Get that wrong and you are not arbitraging — you are catching a falling knife with both hands. The mathematical tool that tells the two apart is cointegration, and as we’ll see, it is emphatically not the same thing as the correlation everyone reaches for first.

Before you read — take a guess

Two stocks have a daily-return correlation of 0.95 over the past year. A junior analyst says 'they're 95% correlated, so a pairs trade is safe — the spread will always revert.' What's wrong with that reasoning?

The pairs-trade idea

Analogy. Picture two dogs — Coke and Pepsi — being walked by the same owner across a field. The owner is “the soft-drink sector,” and as the owner strolls, both dogs roughly follow. The dogs are joined by an elastic leash: one can sprint ahead and the other lag, but the leash keeps yanking them back toward each other. A pairs trader doesn’t bet on where the owner is going (that’s market direction — irrelevant here). They bet on the leash: when one dog bolts too far ahead, short it and buy the laggard, and collect when the leash reins them back in.

Definition. A pairs trade picks two assets driven by the same underlying economic force — two soda companies, two oil majors, an ETF and the basket of stocks it holds, gold and gold miners — and trades the relative price, not the absolute price:

  • Long the cheap leg (the one that has fallen behind).
  • Short the rich leg (the one that has run ahead).

Because you hold one long and one short of comparable size, a market-wide move lifts (or sinks) both legs together and cancels out. The position is market-neutral by construction: you’ve hedged away “the owner” and kept only “the leash.”

ElementCoke / Pepsi exampleWhat it represents
Common driverSoft-drink demand, consumer staplesThe shared “owner” you don’t bet on
Long legWhichever has lagged (looks cheap)Expected to catch up
Short legWhichever has surged (looks rich)Expected to fall back
The betThe gap between them closesThe “leash” tightening
Risk you keepThe pair-specific spreadThe only thing you want exposure to
Info:

Why market-neutral is the selling point

Because the long and short roughly cancel out broad market moves, a well-built pair can make money in a crash, a rally, or a flat tape — it only needs the relationship to behave. That’s why these strategies are prized by funds that want returns uncorrelated with “stocks went up.” The flip side: your entire P&L now rides on the spread, so if the spread misbehaves there’s nowhere to hide.

When to use it

Pairs trading shines when you can name a genuine economic tether between two assets — same industry, same input costs, one is literally a basket containing the other. It struggles when the “pair” is a coincidence dredged up by scanning thousands of tickers for whatever lines up in-sample (data-mined pairs break the instant you trade them). Rule of thumb: if you can’t explain why these two should be tied together to a skeptical colleague in one sentence, you probably have a spurious pair, not a tradable one.

Correlation is not enough

Analogy. Two hikers leave the same trailhead and, for an afternoon, happen to walk in roughly the same compass direction — both drifting north-ish. Their step directions are highly correlated. But there’s no rope between them. By nightfall one is on a ridge and the other in a valley, miles apart, and nothing pulls them back. High correlation, zero anchor. A pairs trade on these two would have you betting the gap closes — and it never does.

The crux. Correlation measures whether two series’ returns (their step-to-step changes) move together. It is silent about levels — about whether the gap between the prices has any tendency to return to a fixed value. You can manufacture two random walks whose daily increments are correlated (push both with a shared shock plus a little private noise) and they will show a fat correlation over any given window — yet because each is a random walk, their difference is itself a random walk, free to wander off to infinity. Correlation: high. Reversion: none.

A stationary series has a fixed long-run mean and variance — it wiggles around a level and keeps coming home. A non-stationary series (the classic example: a random walk, also called integrated of order 1, or I(1)I(1)) has no such home; today’s level is just yesterday’s plus a fresh shock, so it drifts indefinitely. Prices are almost always I(1)I(1). The question for a pairs trade is whether some combination of two I(1)I(1) prices manages to be stationary.

Non-stationary price vs stationary returns
Price (random walk + drift)mean
-0010180

Top: a stationary, mean-reverting series — it strays but a spring keeps yanking it back to its mean, so the gap from the center never grows without bound. Bottom: a non-stationary random walk — each step builds on the last with no anchor, so it wanders off and never has to come back. Correlation can't tell these apart; stationarity is the property a tradable spread must have.

The fingerprint of these two regimes shows up vividly in the autocorrelation function — how related a series is to its own past:

ACF signatures: white noise, AR(1), MA(1)
White-noise band (±2/√n)
1.00.50.0-0.3135791113Lag kAutocorrelation

A mean-reverting (stationary) series has autocorrelation that decays quickly toward zero: the past stops mattering after a short while. A random walk's autocorrelation stays stubbornly near 1 across many lags — every value is glued to its entire history, the signature of something with no mean to revert to.

PropertyStationary spread (what you want)Random walk (the trap)
Long-run meanFixed — it revertsNone — drifts forever
Variance over timeBoundedGrows without bound
AutocorrelationDecays fast toward 0Stays near 1 for many lags
Forecast of the gap”It’ll come back to μ""Best guess = wherever it is now”
Tradable?Yes — bet on reversionNo — there’s nothing to revert to
Warning:

Pitfall — the spurious-regression trap

Regress one random walk on another unrelated random walk and you’ll often get a gorgeous t-stat and a high R² — pure statistical mirage. Two independent trending series look “related” simply because both trend. This is why you can’t just eyeball correlation or a regression’s R²: you must explicitly test whether the residual spread is stationary. Skipping that test is the single most common way beginners build a “pair” that has no rubber band at all.

Fill in the two properties being contrasted.

Pick the right option for each blank, then check.

Correlation measures the co-movement of , but a tradable pairs spread requires a combination — one with a fixed mean it reverts to. A random walk is , so its level drifts forever with no anchor.

Cointegration — the real prize

Analogy. Back to the two dogs on the elastic leash. Individually, each dog’s position is a random walk — it wanders all over the field with no fixed spot it returns to (each is I(1)I(1)). But the leash length — the distance between them — is pinned: it stretches and contracts but always snaps back to its natural length. That leash is a stationary combination of two non-stationary things. That, precisely, is cointegration.

Definition. Two non-stationary (I(1)I(1)) price series PaP_a and PbP_b are cointegrated if there exists a constant β\beta — the hedge ratio — such that the linear combination

St=Pa,tβPb,tS_t = P_{a,t} - \beta\, P_{b,t}

is stationary (I(0)I(0)): it has a fixed mean μ\mu and reverts to it. The vector (1,β)(1, -\beta) is called the cointegrating vector, and StS_t is your spread. The prices can each wander to the moon, but β\beta is tuned so their weighted difference stays leashed.

The hedge ratio β\beta answers “how many units of BB does it take to neutralize one unit of AA?” If asset AA typically moves $1.50 for every $1.00 move in BB, then β1.5\beta \approx 1.5, and a dollar-neutral-ish spread shorts 1.5 units of BB against each unit of AA.

Estimating β — the Engle–Granger two-step

The classic recipe (Engle & Granger, 1987 — it won Granger a Nobel) is two moves:

  1. Estimate the cointegrating vector. Regress PaP_a on PbP_b by ordinary least squares: Pa,t=α+βPb,t+εtP_{a,t} = \alpha + \beta\,P_{b,t} + \varepsilon_t. The slope β^\hat\beta is your hedge ratio; the residual ε^t\hat\varepsilon_t is the spread.
  2. Test the residual for stationarity. Run an Augmented Dickey–Fuller (ADF) test on ε^t\hat\varepsilon_t. Its null hypothesis is “the residual has a unit root” (i.e. it’s a non-stationary random walk — no cointegration). A small ADF p-value (say < 0.05) lets you reject that null and conclude the spread is stationary: the pair is cointegrated, and you have a tradable rubber band.
Reading alpha and beta off the line
α:
Market returnPortfolio return
Beta (slope)
β = 1.0
Alpha (intercept)
α = +0%

Step 1 of Engle–Granger: each dot is a day's (price of B, price of A). The fitted line's slope is the hedge ratio β — how many units of B neutralize one unit of A. The vertical distance from each point to the line is that day's spread (the residual). Step 2 tests whether those residuals are stationary; if they are, the pair is cointegrated.

Worked example. You regress KO on PEP and OLS returns α^=4.0\hat\alpha = 4.0, β^=0.80\hat\beta = 0.80. So your spread is

St=PKO0.80PPEP4.0.S_t = P_{\text{KO}} - 0.80\,P_{\text{PEP}} - 4.0.

You feed the residual series into an ADF test and get a p-value of 0.012. Since 0.012<0.050.012 < 0.05, you reject the unit-root null: the spread is stationary. The pair is cointegrated with hedge ratio 0.80 — short 0.80 shares of PEP for every share of KO and the combination reverts. (If instead the p-value had been 0.34, you’d fail to reject, conclude no cointegration, and walk away — no rubber band.)

StepWhat you doWhat you getDecision
1. Regress PaP_a on PbP_bOLS, read the slopeHedge ratio β^\hat\beta + residual spreadDefines the spread
2. ADF on the residualTest for a unit rootp-valuep < 0.05 → cointegrated (trade it); p large → walk away
Info:

Johansen — the multivariate cousin

Engle–Granger handles two assets and picks one as the “dependent” variable (which can make β^\hat\beta slightly asymmetric depending on which you regress on which). For baskets of three or more assets — or to treat the legs symmetrically — practitioners use the Johansen test, which finds all independent cointegrating vectors at once via an eigenvalue decomposition. Same idea, more legs.

Match each term to its precise meaning.

Pick a term, then click its definition.

When to use it

Cointegration is the right lens whenever you suspect a structural tie that pins a long-run relationship: an ETF and its underlying basket (near-mechanical), two share classes of the same company, a commodity and its producers, cross-listed shares in two currencies. Re-estimate β\beta on a rolling window — the equilibrium relationship can slowly shift, and a stale hedge ratio quietly stops being market-neutral.

Building and trading the spread

You’ve established the pair is cointegrated and you have β\beta. Now you have to turn the spread into signals. Raw spread values (“the gap is $3.20”) are hard to act on — is $3.20 a lot? It depends on the spread’s typical scale. So you standardize it into a z-score: how many standard deviations the spread currently sits from its own mean.

zt=Stμσz_t = \frac{S_t - \mu}{\sigma}

where μ\mu is the spread’s mean and σ\sigma its standard deviation (estimated over a rolling lookback). Now every pair speaks the same language: z=+2z = +2 means “two sigma rich,” z=2z = -2 means “two sigma cheap,” regardless of the asset’s price scale. The classic band strategy:

  • Enter SHORT-the-spread when z+2z \ge +2 (the spread is unusually rich → short AA, long β\beta units of BB).
  • Enter LONG-the-spread when z2z \le -2 (unusually cheap → long AA, short β\beta units of BB).
  • Exit when zz returns near 0 (the spread is back at equilibrium — collect).
  • Optional stop at z=±3z = \pm 3: if it blows through three sigma instead of reverting, the cointegration may have broken — cut the trade rather than average down.

This is the centerpiece. Drag the entry band and resimulate to feel the trade-off between trading often (tight band, more noise) and waiting for conviction (wide band, rarer signals):

Pairs trade: trading the spread’s z-score around its mean
Spread z-scoreLong spread / Short spread entryExitEntry zone
+2.00−2.0+2.0−2.0Mean (exit)0252
Entry threshold (Z)±2.0Round-trip trades0Half-life29 steps

The standardized spread (z-score) oscillates around 0 — its equilibrium. The dashed bands sit at the entry threshold (default ±2σ). When the line pokes above the top band the spread is RICH and the strategy shorts it (accent dot); when it dips below the bottom band the spread is CHEAP and the strategy goes long (accent dot); each position closes when the line reverts back through 0 (brand dot — your exit). Tighten the band toward ±1 and you fire far more trades but chase more noise; widen it toward ±3 and you wait for rarer, higher-conviction dislocations. The ±2σ band is the canonical compromise.

Worked example. Your KO–PEP spread has mean μ=4.0\mu = 4.0 and standard deviation σ=1.2\sigma = 1.2. Today the live spread is St=6.7S_t = 6.7. Then

zt=6.74.01.2=2.71.2=2.25.z_t = \frac{6.7 - 4.0}{1.2} = \frac{2.7}{1.2} = 2.25.

Since z=2.25+2z = 2.25 \ge +2, the spread is rich: enter short-the-spread — short KO, long 0.80 units of PEP per KO share. You’ll exit when the spread falls back toward $4.0 (z0z \approx 0). If instead it kept climbing to z=3.1z = 3.1, your ±3\pm 3 stop would fire and you’d close at a loss, suspecting the rubber band has snapped.

Today’s spread StS_tz=(St4.0)/1.2z = (S_t - 4.0)/1.2Signal
6.7+2.25Short the spread (rich)
5.0+0.83Hold / flat (inside bands)
4.00.00At equilibrium — exit
2.6−1.17Hold / flat (inside bands)
1.5−2.08Long the spread (cheap)
0.3−3.08Stop — likely a broken pair
Tip:

Why ±2 and not ±0.5?

The bands are a bet on noise versus signal. Tight bands (±0.5σ) trade constantly, paying spread and commissions on every wiggle while half your “signals” are just noise that wasn’t really stretched. Wide bands (±3σ) almost never trigger, so your capital sits idle. ±2σ is the time-honored middle: rare enough that a 2-sigma move is genuinely unusual, frequent enough to actually deploy capital. Tune it to the pair’s half-life and your transaction costs, not to a folk constant.

Half-life of mean reversion

A stationary spread reverts — but how fast? A spread that closes its gap in two days is a great trade; one that takes eight months to revert ties up capital, racks up financing costs, and gives the relationship ample time to break before you ever collect. The speed of reversion is captured by the half-life.

The model. Model the spread as an Ornstein–Uhlenbeck process (the continuous-time cousin of an AR(1) autoregression): each period the spread is pulled back toward its mean by a fraction, plus a random shock. In discrete AR(1) form:

Stμ=ϕ(St1μ)+ϵt,S_t - \mu = \phi\,(S_{t-1} - \mu) + \epsilon_t,

where ϕ\phi (between 0 and 1) is how much of yesterday’s deviation survives into today. A ϕ\phi near 1 means sluggish reversion (most of the gap persists); a small ϕ\phi means snappy reversion. The continuous mean-reversion speed is κ=lnϕ\kappa = -\ln\phi, and the half-life — the time for the spread to close half its distance to the mean — is

t1/2=ln2κ=ln2lnϕ.t_{1/2} = \frac{\ln 2}{\kappa} = \frac{\ln 2}{-\ln \phi}.

Mean reversion: an Ornstein–Uhlenbeck process pulled back to its mean
3 pathsNo reversion (κ=0)Long-run mean 100
98115132Long-run mean 1000252
Reversion speed (κ)5.0Half-life35 steps

The spring in action: the spread (wandering line) gets repeatedly yanked back toward its mean. The half-life readout is how long a typical 'halfway home' journey takes — the natural clock of the pair. A short half-life means quick round trips and quick capital recycling; a long half-life means you're committing capital for a long, exposed ride.

Worked example. You fit AR(1) to the daily spread and get ϕ=0.95\phi = 0.95. Then:

κ=ln(0.95)=0.0513,t1/2=ln20.0513=0.69310.051313.5 days.\kappa = -\ln(0.95) = 0.0513, \qquad t_{1/2} = \frac{\ln 2}{0.0513} = \frac{0.6931}{0.0513} \approx 13.5 \ \text{days}.

So a typical dislocation takes about 13.5 trading days to close half its gap — call it roughly three weeks for a full round trip. That sets expectations: hold for days-to-weeks, not minutes; budget financing/borrow costs over that window; and if a trade is still open well past a couple of half-lives, treat it as a warning, not a bargain.

AR(1) coefficient ϕ\phiκ=lnϕ\kappa = -\ln\phiHalf-life =ln2/κ= \ln 2 / \kappaReading
0.700.357≈ 1.9 daysSnappy — fast round trips
0.900.105≈ 6.6 daysBrisk
0.950.051≈ 13.5 daysModerate — a few weeks
0.990.0101≈ 69 daysSluggish — months; costs may eat it
1.000Not reverting at all (unit root!)
Warning:

Pitfall — a half-life that's longer than your patience (or your borrow)

As ϕ1\phi \to 1, the half-life explodes toward infinity — and ϕ=1\phi = 1 is a random walk with no reversion at all. A pair with a 200-day half-life is barely distinguishable from a broken (non-cointegrated) pair, and you’ll pay shorting/borrow and financing costs the entire time you wait. Always sanity-check: is the half-life short enough that the expected reversion profit clears your accumulated holding costs? If not, the trade is uneconomic even if it’s technically cointegrated.

When to use it

Use the half-life to size your horizon and your costs, not as a go/no-go gate by itself. Match your data frequency and stop-out time to it (a 13-day half-life wants daily bars and a multi-week patience, not a 5-minute chart). And compare half-life across candidate pairs: given two cointegrated pairs, the shorter half-life recycles capital faster and spends less time exposed to the relationship breaking.

When it breaks

Here’s the uncomfortable truth: cointegration is a statistical observation about the past, not a law of nature. The leash can snap. A merger or acquisition fuses or severs the relationship overnight; a regime shift (new regulation, a technology that disrupts one firm, a commodity shock that hits one leg harder) permanently re-rates one side; one company’s fundamentals genuinely diverge — different growth, different debt, different fate. When that happens, the “spread” you’re trading is no longer a rubber band. It’s just two prices going their separate ways.

The killer failure mode. Your spread hits z=3z = -3. Your model screams “historically cheap — load up!” So you double down. But the reason it’s at 3-3 is that the relationship broke — one firm got crushed by news the model can’t see — and the spread keeps right on going to 4-4, 5-5, never reverting. You’ve walked straight into a value trap: averaging into a position precisely because it looks cheap, when “cheap” is actually “permanently repriced.” This is how pairs books blow up. The mean-reversion logic that makes the strategy work is the same logic that destroys you when the mean has moved.

Analogy. The leash didn’t stretch — it broke. You keep pulling, expecting the dog to be yanked back, but there’s no dog on the other end anymore. Every tug just pulls slack.

Risk management — what actually keeps you alive:

  • Hard stops (e.g. exit at z=±3z = \pm 3): cap the loss on any single pair instead of averaging into a broken one. A stop is you admitting “if it hasn’t reverted by here, my reversion thesis is probably wrong.”
  • Position limits per pair and across pairs: no single rubber band should be able to sink the book. Diversify across many weakly-related pairs so one snapped leash is a scratch, not a wound.
  • Monitor a rolling ADF p-value: re-run the cointegration test on a moving window. If the p-value creeps up (the spread is losing its stationarity), that’s an early warning the relationship is decaying — derisk before it’s a disaster.
  • Watch for corporate events: flag mergers, spin-offs, index changes, earnings on either leg. These are the usual suspects behind a sudden break.
Warning:

Pitfall — confusing 'it always reverted before' with 'it must revert now'

Every blown-up pair has a backtest showing beautiful reversion right up until the day it didn’t. The historical stationarity that got you into the trade carries no guarantee for tomorrow. Treat cointegration as a perishable edge that must be continuously re-verified, not a permanent property you can set and forget. The trader who survives is the one with a stop, not the one with the prettiest backtest.

Your cointegrated spread, normally bounded within ±2.5σ, blows through −3σ and a week later sits at −4.5σ with no sign of reverting. Meanwhile one of the two companies just announced it's being acquired. The most defensible action is to:

Putting it together

Pairs trading is the original statistical arbitrage: find two assets tethered by a shared economic force, go long the cheap leg and short the rich one, and harvest the gap as it closes — market-neutral by construction. The non-obvious key is that correlation isn’t the tether — correlation is about returns co-moving, with no anchor — whereas cointegration gives you a stationary spread with a fixed mean it reverts to. Estimate the hedge ratio β\beta (Engle–Granger: regress, then ADF-test the residual), standardize the spread to a z-score, trade the ±2σ bands, read the half-life (ln2/κ\ln 2 / \kappa) to size your horizon and costs — and never forget the leash can break, so keep a stop.

Big picture

Pairs trading & cointegration at a glance

  • Pairs trading
    • The trade
      • Two assets, one shared driver
      • Long cheap leg, short rich leg
      • Market-neutral by construction
    • Correlation ≠ cointegration
      • Correlation = returns co-move (no anchor)
      • Two random walks can correlate yet drift apart
      • Need a STATIONARY spread that reverts
    • Cointegration
      • S = Pa − β·Pb is stationary (I(0))
      • β = hedge ratio (cointegrating vector)
      • Engle–Granger: regress, then ADF-test residual
      • Johansen for 3+ legs
    • Trading the spread
      • z = (S − μ)/σ
      • Short at z≥+2, long at z≤−2, exit near 0
      • Stop near z=±3 (maybe broken)
    • Half-life
      • t½ = ln2 / κ = ln2 / (−ln φ)
      • φ=0.95 → ≈13.5 days
      • Sets holding period & cost budget
    • When it breaks
      • Mergers, regime shifts, fundamentals diverge
      • Value trap: doubling down at z=−3
      • Stops, limits, rolling ADF monitoring
From the trade idea, through the math that makes it real, to the discipline that keeps it alive.

Pairs trading & cointegration: lock it in

Question 1 of 40 correct

Two stocks have a 0.92 daily-return correlation, but when you regress one on the other and run an ADF test on the residual, the p-value is 0.40. Should you trade the pair as a mean-reverting spread?

Check your answer to continue.

One-line recap of the whole pipeline

Pick an economically-tethered pair → confirm cointegration (regress for β\beta, ADF-test the residual spread) → standardize the spread to a z-score → trade the ±2σ bands and exit near 0 → use the half-life (ln2/κ\ln 2 / \kappa) to set horizon and check costs → keep a stop and monitor a rolling ADF p-value, because the leash can break.

You now know how to find a tradable spread and when to bet on it reverting. But a sharper question lurks underneath: how do you even know, in general, whether a market wants to revert (snap back, like our spread) or trend (keep going, where doubling down is correct and fading is suicide)? Pairs trading is a pure mean-reversion bet — its mortal enemy is a regime where things keep diverging. The next lesson, Mean Reversion vs Momentum, zooms out from the single spread to the two opposing forces that govern all systematic strategies, and how to tell which one you’re standing in.

Mark lesson as complete