Basic Prerequisites: 03 · Pairs Selection & Hedge and 02 · Cointegration & the Spread.


1. Intuition & Practical Objective

Once a pair and its hedge ratio are fixed, the strategy is a rule on the spread: open when the spread is far from equilibrium, close when it returns. The whole art is in two numbers - the entry threshold and the exit threshold - expressed in standard deviations of the spread so that the same constants work across every pair. This page gives the rule, the exact P&L identity of a dollar-neutral pair, and a closed-form backtest you can run and audit.

The standard deviation is the natural unit because the OU spread is Gaussian in equilibrium: a excursion is expected to recur with a known frequency, and the time it takes to revert is governed by the half-life. Entry, exit and stop must all be consistent with : entering a move in a spread with a 250-day half-life is not a trade, it is a position.


2. Mathematical Ground Truth & Derivations

2.1 The z-score signal

Rolling on the formation window (or an expanding window), estimate of the spread , and define

Canonical rule (the flat-file convention, made precise):

ConditionAction
Short the spread: short , long
Long the spread: long , short
Flat (converged)
Stop out (possible cointegration break)

The stop is not arbitrary: under a correct model, should occur with probability per observation, so its repeated occurrence is evidence the model has broken, not a bargain.

2.2 The Avellaneda–Lee s-score (a drift-adjusted z-score)

Avellaneda & Lee define the dimensionless s-score from the OU parameters over a 60-day window,

and trade: open short if , open long if , close short at , close long at . Including the drift gives the “modified s-score” , which just shifts the thresholds by in practice - the built-in momentum term.

2.3 The P&L identity (why pairs trading is “free” of the market)

Long $1 of , short of . In log-price space the one-period portfolio return is

So the cumulative P&L is the change in the spread between entry and exit, and the market factor cancels to first order. Over the holding period from entry at level to exit at the gross P&L is (for a short-spread position), i.e. the number of standard deviations captured.

2.4 Sharpe and the cost drag

With per-period returns , the annualised Sharpe is

Transaction costs enter as per change with bp per leg (10 bp round-trip for the two-leg book), and borrow cost on the short leg accrues daily. A pairs strategy’s gross Sharpe is high; the net Sharpe is a cost-and-turnover phenomenon, which is exactly why the half-life matters (fast reversion → shorter holding → more turnover).


3. Computational Implementation - the backtest

Experiment A - full formation/trading backtest. We simulate a cointegrated pair (common log-price factor + stationary log-spread with , half-life days), estimate the hedge ratio and spread moments on a 252-day formation window, then trade the next 252 days with the rule. Stdlib only.

The book earns gross over the year ( net of 10 bp round-trips) at a gross-exposure Sharpe of - a market-neutral profile. Note the cost drag: position changes (i.e. leg-trades) cost , about a quarter of the gross P&L. Turnover is the enemy, which is why the half-life screen matters.

Experiment B - the Avellaneda–Lee s-score. Estimate the OU parameters from a 60-day window and read today’s s-score and half-life.

The estimated half-life is days (fast, well inside the filter) and the s-score is - inside the entry band, so no trade: most of the time a well-behaved spread sits near equilibrium.


4. Failure Modes & First-Principles Breakdowns

  1. Thresholds fitted to the backtest. Choosing because they maximise historical Sharpe is in-sample optimisation; the Deflated Sharpe Ratio corrects for exactly this (Backtesting Hygiene).
  2. The stop is a model-rejection test, not a loss cap. Repeated means the cointegration has broken; averaging down (“it must revert”) is the classic way a market-neutral book dies.
  3. Costs scale with turnover, turnover scales with . A spread with a 5-day half-life can turn the book over every week; two legs of spread cost then dominate. Always report net-of-cost Sharpe.
  4. Non-synchronous legs. If one leg trades thinly, the closing-price spread is stale and the backtest fills at prices you cannot get (GGR’s bid-ask discussion). Use quotes or trade both legs simultaneously.
  5. Borrow and short availability. The short leg may be unborrowable or expensive exactly when the signal is strongest (big divergence) - an unmodelled asymmetry.

5. References

  • Avellaneda, M. & Lee, J.-H., Quantitative Finance 10(7), 2010
  • Gatev, Goetzmann & Rouwenhorst, RFS 19(3), 2006
  • Tsay, Analysis of Financial Time Series
  • Krauss, C., J. Economic Surveys 31(2), 2017
  • Gatev et al. and Do & Faff for the empirical cost-adjusted Sharpe collapse.

6. Connected Graph Bridges