How to read it

The hedge ratio

Regress the log of one close on the log of the other. The slope says how many rupees of the second leg offset one rupee of the first, to a first approximation. Swapping which index is y gives a different slope, because a regression is not symmetric.

The test

The spread is y less slope times x less the intercept. If it keeps returning to a mean, a Dickey Fuller test on it gives a statistic below a critical value. The values used are the Engle Granger ones, because the slope was estimated from the same data, and they are stricter than the plain tables.

The half life

Fit the spread today on the spread yesterday. A coefficient between 0 and 1 means it pulls back, and the half life is how many sessions it takes to close half of a gap. A half life much longer than the sample is not evidence of anything.

The held out part

Everything above is estimated on the first part of the sessions only. The ratio, intercept, mean and spread of the fitted part are then carried over, unchanged, to the rest. If the relationship is real the held out spread should look like the fitted one. The cointegration module builds the test and the walk forward module explains why the split matters.

What it leaves out

Daily closes of two indices are not futures prices: a real pair would trade two futures that roll every month, with margin, costs and bid ask spreads. Both indices contain the large banks, so a link between them is expected, which is not the same as a gap that can be traded. One split is one test; changing the window and the split until the numbers look good defeats the purpose. The count of stretched readings is a count of past gaps, not a promise about the next one.

Go to the source

  1. NSE, equity derivatives contract specifications: lot sizes of the Nifty and Nifty Bank contracts
  2. Engle and Granger, Co-integration and error correction: representation, estimation and testing, Econometrica (1987) paper
  3. MacKinnon, Critical values for cointegration tests, Queen's University working paper 1227 (2010) paper
  4. Gatev, Goetzmann and Rouwenhorst, Pairs trading: performance of a relative value arbitrage rule, Review of Financial Studies (2006) paper