← All lessons

Pairs

Trade the spread between two related series · 9 min

ProGoal: Trade the spread between two related seriesBefore this: BandsFurther reading: Chan, Algorithmic Trading
Two generated markets that move together
0.650.851.050299
  • Market A (rebased)
  • Market B (rebased)

Each wanders on its own, but the gap between them keeps closing.

Predict first

Two markets usually move together. Today B jumps 5% while A is flat. What does a pairs trader do, if the pair reverts?

A pair is two markets tied by something real: two companies in the same business, a stock and its index, two deliveries of the same commodity. Each can trend, but the spread between them may revert. A pairs trade holds one long and one short, so the market's overall moves mostly cancel.

spread = log B − h × log A (h = hedge ratio, from a regression on past data)
trade the z-score of the spread: short B, long h × A when z ≥ +k, and the reverse

The hedge ratio must be estimated on data before the trading period; fitting it on the whole history leaks the future into the test. The big risk is a broken link: a merger, a new product, a change in the business. Then the spread trends, and a reversion rule keeps adding to a loser. Switch the relationship below to see it.

Try it: a pair, its spread and a broken link
0.310.801.290755
  • A (rebased to 1)
  • B (rebased to 1)
-3.90.14.20755
  • Spread z-score (30 days)
  • Entry levels
0.99×1.17×1.35×0505
  • Pair trade, after costs
Hedge ratio (first year)1.21
Return correlation0.92
Sharpe ratio2.52
Return a year16.1%
Volatility6.0%
Max drawdown-3.7%

The hedge ratio is fitted on the first 250 days only; trading starts after them.

Generated markets, not real data. They show how a rule depends on the market it meets; they do not predict how real markets behave.

Worked calculation

Spread and z of a pair (in price terms)

B, A, hedge ratio
82.40, 50.00, 1.6
Hedge leg
1.6 × 50.00 = 80.00
Spread = B − 1.6 × A
82.40 − 80.00 = 2.40
Spread mean, standard deviation
0.50, 0.95
z of the spread
(2.40 − 0.50) ÷ 0.95 = +2.0: sell B, buy 1.6 A per B
Check yourself
3 questions

A pair has reverted for years. One of the companies is bought by a rival. What should a pairs trader expect?

B = 64.00, A = 30.00, hedge ratio 2. What is the spread B − 2A?

The spread is 4.00, its mean 1.00 and its standard deviation 1.20. What is its z-score, and the trade?

Missed questions come back for review after one day, then three, then a week.

Practice

Pair: B trades at 83.26, A at 50, hedge ratio 1.5 (short 1.5 A per B held). What is the spread B − 1.5 × A?

Hint: Spread = price of B − hedge ratio × price of A.

More in Drills →

Closing round

Three years of a fresh generated world are on screen; the next two years do not exist yet. Tune the rule on what you can see, commit to two predictions, then generate the future.

0.97×1.12×1.26×0625
  • Your rule so far
Sharpe before split1.60
Return before split25.8%
Max drawdown before-4.0%

Over the next two years, after costs, this rule will…

Will the pair still revert after the split?

Generated markets, not real data. They show how a rule depends on the market it meets; they do not predict how real markets behave.