Finance Fluent

Statistical Arbitrage and Pairs Trading:Why the Spread Is the Easy Part

How pairs trading works, why cointegration beats correlation, how half-life and z-score thresholds set the trade, and why costs and breaks decide the result.

The z-score of a simulated pair spread crossing its two-standard-deviation entry bands and reverting to zeroThe z-score of a simulated pair spread crossing its two-standard-deviation entry bands and reverting to zero
Quantitative AnalysisThe z-score of a simulated pair spread crossing its two-standard-deviation entry bands and reverting to zero

Statistical arbitrage is a bet that a relationship between prices, measured over a long history, will reassert itself after a short departure. The classic form is pairs trading: buy the one that has fallen behind, sell the one that has run ahead, and wait for the gap to close. It is not arbitrage in the textbook sense. Nothing forces the gap to close, and you can lose on both legs.

That word "statistical" carries the whole risk. A true arbitrage locks in a profit at the moment you trade. A statistical one offers a favourable probability, estimated from data that may no longer describe the world. The construction of the spread takes an afternoon. Deciding whether the relationship behind it is real, and whether it survives costs, is the actual work.

Correlation is the wrong test

Two assets are correlated when their returns tend to move together on the same day. Two assets are cointegrated when a particular weighted difference of their prices keeps returning to a stable level, even if each price wanders freely on its own.

The answer to which one you need is cointegration. Correlation describes short-run co-movement and says nothing about whether the gap between the prices is bounded. Two stocks can have a correlation of 0.95 on daily returns and still drift apart for years, because small daily differences accumulate. A spread that never comes back is not a trade, it is a position.

The standard formalisation is the work of Engle and Granger (1987), who showed that non-stationary series can share a stable long-run relationship and that this relationship can be estimated and tested. For a pair, the Engle-Granger two-step procedure is the practical tool. First regress one price on the other; the slope is your hedge ratio and the residual is your spread. Then test the residual for a unit root, usually with an augmented Dickey-Fuller test. If you can reject the unit root, the spread behaves as though it is pulled back to a mean.

Two cautions belong here. The test is run on a residual that was itself fitted to the same data, so the usual critical values are too lenient and need the adjusted tables designed for this purpose. And the regression is not symmetric: putting A on the left gives a slightly different hedge ratio from putting B there. Neither is wrong, but a pair that passes in one direction and fails in the other deserves suspicion.

When there are more than two legs

The Johansen test generalises the idea to baskets. Instead of one regression, it examines a whole system of prices at once and counts how many independent stable combinations exist. With three assets there can be zero, one or two. The advantage over Engle-Granger is that it does not force you to choose a dependent variable and it can find several relationships together.

You do not need the mechanics to use the idea. What matters is the trade-off it exposes: a basket gives you more candidate spreads and more diversification across them, but every extra leg multiplies transaction costs and the number of ways the estimate can be fooled. For most individual practitioners, pairs and small baskets are the sensible limit.

A separate line of work builds the spread without picking partners at all. Avellaneda and Lee (2010) construct market-neutral portfolios by regressing stock returns on principal components or on sector ETFs and trading the residuals, and they also relate the strategy's performance to the market cycle. The point to take from it is that the "pair" is a special case of a general idea: strip out what the common factors explain, and trade what is left.

Where pairs come from

The original large-sample study, Gatev, Goetzmann and Rouwenhorst (2006), matched US stocks into pairs by minimum distance between normalised price series over a formation period, then traded divergences over the following months. Their sample runs on daily data from 1962 to 2002 and reports annualised excess returns of up to about 11 percent for self-financing portfolios of top pairs. That is a historical result for one rule on one market, in a period when the strategy was far less crowded, and it should be read that way.

A distance rule finds pairs that moved together. It does not find pairs that have a reason to. My preference is to start from the economics and then confirm with the statistics: two instruments that share a driver, such as two companies in the same line of business, two futures on neighbouring maturities, or an index and a basket that mostly replicates it. A pair found only by searching ten thousand combinations will contain plenty that pass a cointegration test by luck, and the more combinations you try, the more certain that becomes.

How fast does the spread come back

Passing a test says the spread reverts eventually. It does not say whether eventually means ten days or ten years, and that decides whether the pair is tradeable.

The usual model is the Ornstein-Uhlenbeck process, whose discrete form is simply an AR(1): each day the spread keeps a fraction phi of yesterday's deviation and receives a random shock. The half-life is the time for a deviation to shrink by half, which works out to the natural logarithm of 2 divided by minus the log of phi. You can estimate it by regressing the daily change in the spread on its lagged level.

The simulated pair below uses a phi of 0.94, a true half-life of 11.2 days. A regression run on the 310 daily observations the simulation produced estimated 7.6 days. That is an error of about a third from roughly fifteen months of clean, perfectly stationary data, and real data is neither clean nor stationary.

Simulated z-score of a mean-reverting pair spread over 250 trading days with entry bands at plus and minus two standard deviations and an exit line at zero. Three round trips are marked, lasting 20, 13 and 7 days. +2 0 -2 0 50 100 150 200 250 trading day z-score of the spread (simulated)
Simulated data, not a market series. The spread is a discrete Ornstein-Uhlenbeck process with phi 0.94 and unit shocks, random seed 20250524, and the z-score uses a 60-day rolling mean and standard deviation. Dark points are entries at the first close beyond two standard deviations; green points are exits at the first crossing of zero. The z-score ranged from -2.65 to 2.85, and the three round trips lasted 20, 13 and 7 days, averaging 13.3. The half-life estimated from these same observations was 7.6 days against a true 11.2.

Two practical rules follow. If the half-life is longer than the holding period you can tolerate, the pair is not for you regardless of its p-value. And treat any half-life estimate as a range, not a number, and re-estimate it on rolling windows to see how much it moves.

Entry thresholds are a cost decision

The usual rule is to enter when the z-score passes two in either direction and exit when it returns to zero. Two is a convention. What makes a threshold right or wrong is arithmetic about costs.

If you enter at a z-score of two and exit at zero, the gross move you are paid for is two standard deviations of the spread. A lower threshold trades more often and earns less per trade, while a higher one earns more per trade and trades rarely. Costs are paid per trade, so the question is how much of the gross each round trip surrenders.

Entry z-score Gross captured (spread sd of 1% of notional) Share eaten by 0.4% round-trip costs
1.0 1.0% 40%
1.5 1.5% 27%
2.0 2.0% 20%
2.5 2.5% 16%

Those figures are illustrative, not measured. The shape is what matters: at a z-score of one, nearly half of a perfectly executed trade is gone before slippage. A higher threshold looks safer on this arithmetic but has its own price, which is that fewer trades give you a thinner sample for judging whether the edge exists at all.

The exit deserves the same scrutiny. Waiting for exactly zero means holding through the slowest part of the reversion, where each extra day earns little. Some practitioners exit short of zero for that reason. The cost is that they leave some profit behind, and which side of that trade is better can only be settled with data on your own pair.

The short leg is where a market's rules show up

Everything above treats a short position as free and instant. It is neither. Short selling needs borrowable stock, borrowing has a fee that can change, the lender can recall the shares, and some markets restrict shorting outright.

As a worked example, take Indian cash equities. SEBI's framework for short selling (January 2024) does not permit naked short selling: every investor must deliver the securities sold at settlement. A short leg that is held for days, as a pair's usually is, therefore has to come from one of two places. The first is single-stock futures, where the short is a derivatives position with a lot size, an expiry, a basis to the cash price and a margin requirement under the exchange's SPAN framework (the NSE margin documentation is the authority). The second is the securities lending and borrowing mechanism run by NSE Clearing, where eligible securities, largely those in the futures and options segment, can be borrowed against a fee for a defined tenure.

Each choice reshapes the pair. Futures leave you trading a spread of a cash price against a futures price, so the roll at expiry becomes part of the trade and the basis becomes part of the spread. Borrowed stock keeps the legs in the same instrument but adds a fee that runs every day and the risk of an early recall that forces you out at a bad moment. Other markets have their own versions: locate requirements, short-sale bans in a crisis, borrow fees that spike on crowded names. The principle is portable. Before trusting a backtest, ask how the short leg would actually have been held, and whether it could have been held at all on the days that mattered. Rules and rates change, so check the current circulars rather than any summary, including this one.

What breaks the spread

Three failures account for most of the damage, and none of them shows up in an in-sample test.

Structural breaks. A merger, a change in a company's business, a regulatory change or a technology shift can permanently move the relationship between two prices. The spread then goes to four standard deviations and keeps going, and the rule that said to buy more at three is now averaging into a loss. This is why a hard stop on the z-score, set beyond where the relationship has plausibly ever gone, belongs in the rules from the start. A spread that is beyond its history is more likely to be broken than stretched.

Crowding. If many participants run similar spreads, entries and exits bunch together and the reversion that paid in the past gets arbitraged down. Worse, the crowd is hidden. You cannot see it in the data until it unwinds.

The unwind. The clearest case is August 2007. Khandani and Lo examined the week of 6 August 2007, when a number of quantitative long and short equity funds suffered unusual losses together, and argued that the evidence is consistent with a rapid liquidation of similar portfolios. They are open that their conclusions rest on indirect evidence and are speculative, and a reader should be equally careful. The lesson holds regardless of the exact cause. When one holder has to sell, the price move hurts every holder of the same position, so diversification across pairs offers little protection against a shared exit.

Sizing, and kill-switches that do not ask permission

A pair is a bet on a spread whose volatility is itself an estimate, so size by the spread's risk rather than by rupees. Dollar or rupee neutrality is a starting point: it makes the two legs equal in value, not equal in risk, and the hedge ratio from the regression is the better guide to how much of each to hold. Check it again at intervals, since it drifts. The ideas in risk management on volatility targeting apply directly, as does the point that estimates of volatility lag behind volatility itself.

Across a book of pairs, the dangerous number is the correlation between the spreads, not between the stocks. Twenty pairs that all depend on the same sector or the same funding conditions are one position. The treatment of concentration in portfolio construction is the right frame: measure risk contribution, not count.

Then there are the controls that act without a decision from you. A stop at a fixed z-score beyond history. A time stop, which closes the trade when it has lasted several half-lives with no reversion, since a trade that has not worked in that time is telling you the model is wrong. A portfolio-level loss limit that flattens everything. These are worth writing down before the first trade because the moment they are needed is the moment judgement is at its worst.

Testing without fooling yourself

A backtest of a pairs strategy is unusually easy to get wrong, because the whole method begins with a search. You search for pairs, then for thresholds, then for windows, and each search selects whatever happened to fit the sample. The result looks like skill and is mostly the search.

The safeguards are dull and effective. Select pairs and fit hedge ratios only on data that comes before the period you trade. Hold out a final stretch that you touch once, after every decision is made. Use walk-forward testing, where you re-estimate on a rolling window and trade the next block, so the test reproduces what you would actually have known at the time. Count every pair and parameter you tried, and treat a good result among thousands of candidates with the scepticism it deserves. The broader reasoning on this, including leakage and multiple testing, is in quantitative analysis.

Then put costs in properly: both the fee schedule and a slippage assumption set from the actual spread between bid and offer, plus the borrow or futures cost on the short leg. A strategy that survives all of this has earned a small amount of trust, no more. It still has to survive the day the relationship changes, and no test can tell you when that is.

Read next

The rest of the shelf

Everything else on the site, newest first. On a wide screen this index travels sideways as you scroll. Tab into it and it becomes an ordinary grid, so nothing you are focused on is ever parked off-screen.

Income each year from a five-rung bond ladder and from a single bond when rates fall two points, against an unchanged-rate baseline

Portfolio Management

Income Portfolio Construction

Build a portfolio for cash flow rather than headline yield: duration and reinvestment, yield traps, REITs and InvITs, and stress-testing the income itself.

22 Jun 202515 min

A simulated macro composite score with its regimes shaded, and beneath it the capped factor tilt it implies a month later

Portfolio Management

Macro-Driven Factor Rotation

How to turn liquidity, PMI and yield-curve data into modest factor tilts, with guardrails, honest measurement, and the case that timing often fails.

14 Jun 202513 min

A year of simulated daily returns tested against a normal-model 99 percent VaR, with the exceptions marked and placed on the Basel traffic light

Risk Management

Monte Carlo Value-at-Risk, Step by Step

How Monte Carlo VaR works end to end: covariance, Cholesky shocks, full revaluation, fat tails, convergence, backtesting and expected shortfall.

06 Jun 202516 min

A simulated price series above its RSI and MACD panels, with the bars where both indicators agree marked

Technical Analysis

RSI and MACD Confluence, Tested Honestly

How RSI and MACD are computed, what combining them can and cannot add, and how to test a confluence rule against overfitting, costs and data snooping.

30 May 202516 min

The payoff of a long call butterfly at expiry, with the maximum at the middle strike, both breakevens and the debit marked

Options & Trading

Butterfly Option Structures Explained

How butterfly option structures actually work: the payoff shape, why iron and long butterflies are the same trade, and the honest risk in a broken wing.

16 May 202511 min

An iron condor payoff at expiry, showing the two credit zones, the flat band of net credit and the capped loss on each wing

Options & Income

Credit Spreads and Iron Condors

How credit spreads and iron condors work, what the premium compensates you for, the margin reality, and the payoff shape that catches option sellers out.

11 May 202510 min

A walk-forward validation split: six folds of expanding training data, each with a one month embargo and a twelve month test window

Machine Learning

Machine Learning for Stock Selection

Applying machine learning to equity selection: why cross-validation breaks on time series, where data leakage hides, and when a linear model is better.

06 May 20259 min

A protective put payoff drawn against the unhedged portfolio line, with the floor, the breakeven and the constant cost of the premium

Options & Hedging

Hedging a Portfolio with Index Options

How to hedge an equity portfolio with index options: sizing the hedge, what protective puts and collars actually cost, and when not to bother at all.

29 Apr 202510 min

An equity curve against its high-water mark with the underwater plot beneath, and the gain the deepest drawdown demands to recover

Risk Management

Risk Management Essentials

Why drawdowns are harder to recover than they look, what Value at Risk does and does not tell you, and how to size positions so a bad month stays survivable.

22 Apr 202510 min

A two-asset efficient frontier, the straight line it would be if the assets were perfectly correlated, and the minimum-variance point

Portfolio Management

Portfolio Construction and Diversification

How diversification actually creates value, what the efficient frontier shows, and why mean-variance optimisation produces portfolios nobody should hold.

13 Apr 202510 min

A scatter of 150 forward returns against factor exposure, with the fitted least-squares line and its standard error

Quantitative Analysis

Quantitative Analysis in Finance

How quantitative analysis works: handling market data properly, the statistics that earn their place, factor models, and the four ways a backtest lies to you.

06 Apr 202511 min

A price series with its 50-bar moving average, and a dimension line measuring how many bars later the average turns

Technical Analysis

An Introduction to Technical Analysis

Technical analysis explained honestly: what the charts actually show, which claims survive testing, and how to check whether an indicator works at all.

25 Mar 202511 min

The balance sheet identity drawn as two stacked columns of equal height, assets on one side and liabilities plus equity on the other

Fundamental Analysis

Fundamental Analysis Explained

Fundamental analysis in practice: which financial statement to trust, what the ratios really answer, and the governance red flags that precede most failures.

24 Mar 20259 min

One subject, worked out in full rather than summarised.

Open the full index