On 15 Sep 2026 the log spread between Bank Nifty and Nifty stood a little above one usual size from its average if I used every session in the file, and close to zero if I used only the last sixty. Same day, same spread, two answers, and neither was wrong. A z score is a distance measured in the spread's usual size, and the usual size depends on the window you choose. That is the first thing the cointegration toolkit teaches: every number in it is an estimate from a window, and each choice of window is a decision the data did not make for you. This lesson builds the Engle Granger test step by step, adds half life and z score, and runs it on 300 dated NSE closes with a part held out. Nothing here is live, and nothing is a view on a trade.

3By the end you can

  1. Run the two steps of the Engle Granger test and read the statistic against the strict cutoffs.
  2. Work out a half life from the spread's pull back and a z score from a window, and say why both depend on choices.
  3. Explain why many pairs, a fitted ratio and one window each make a pass less reliable.
Two teal and blue strands twisting across the frame, joined by lit rungs

The idea, plainly

Two steps

The pair trading intuition module explained why correlation does not make a pair. The Engle Granger method is the standard way to ask the better question. Step one regresses the log of one price on the log of the other over a formation window. The slope is the hedge ratio and the leftover is the spread. Step two tests that spread for a unit root. A unit root means the spread wanders and has no home. Rejecting it is evidence that the spread keeps returning to one.

Fit, test, measure, then judge on days not used

The Engle Granger toolkit as a chain of steps: regress log prices on a formation window, form the spread, test it against Engle Granger values, measure half life and z score, then judge on a held out windowDiagram with 5 boxes. Regress log y on log x to Spread = residual; Spread = residual to Unit root test; Unit root test to Half life, z score; Half life, z score to Judge on held out days.Regress log y on log xslope = hedge ratioSpread = residualy less ratio times x, lessconstantUnit root testEngle Granger valuesHalf life, z scorehow fast, how farJudge on held out daysratio and mean frozen
The order of the toolkit. Everything before the last box is estimated on the formation window, and the last box uses only what was frozen at its end. Illustration of the method, with no prices. Source: RupeeCase illustration of the method. As of 15 Sep 2026.

Reading the statistic

The test statistic is the t value of the spread's own lagged level in a Dickey Fuller regression, with one lagged change added. More negative is stronger evidence of a home. The usual Dickey Fuller table is the wrong ruler here. The regression in step one picked the slope that made the spread as calm as possible, so the spread looks tamer than a random one and the plain table rejects too easily. The Engle Granger values are stricter. For two series with a constant, the five percent value is about minus 3.34, and the one percent value is stricter again.

Half life and z score, in formulas

Fit the spread on its own previous value. The coefficient phi sits between zero and one when the spread pulls back.

s(t) = phi x s(t-1) + e
Half life =
minus ln 2 / ln phi
z = (s minus mean) / sd

A phi of 0.98 gives a half life of about 34 sessions: the gap closes half its distance in that time on average. The mean and sd in the z score come from a window, which is why the same day can read differently under different windows. If phi is at or above one the spread has no half life at all.

Which way round

A regression is not symmetric. Regress Nifty on Bank Nifty and you get one slope and one statistic. Swap them and both change, because ordinary least squares minimises errors in one variable only. In this sample the two directions gave different statistics and very different half lives, though both failed. If a pair passes in one direction and fails in the other, that is itself a warning. Say which leg is y.

How long a sample, how long a half life

A half life is only useful next to the sample it came from. If the gap takes about as long as the whole file to close half its distance, the file holds almost no completed returns to learn from. A working rule is to want several half lives inside the sample, and ideally many separate stretches that left the mean and came back. Two years of daily closes is a few hundred sessions, so a half life of a month leaves room for only a handful of cycles. Short windows are noisy, long windows hide breaks. A relationship that held in one stretch can change when index weights change, when a regulation moves a sector, or when the two sets of stocks begin to be traded differently.

The term this section turns on: Half life

The term this section turns on: Half lifeThe term this section turns on: Half life. Half life: Minus the log of 2 over the log of phi, the spread's pull back coefficient. It counts the sessions to close half a gap.Half lifeMinus the log of 2 over the log of phi, thespread's pull back coefficient. It counts thesessions to close half a gap.
From the module glossary; every term is in the Learn glossary too. Source: Module 18.7, Cointegration toolkit: Engle Granger, ADF, half life and z score.

Many pairs, many chances

Statistical arbitrage means running a rule like this across many pairs or baskets, with small positions and a statistical edge in each. The danger is arithmetic. A test at the five percent level passes about one pair in twenty by luck alone. Screen twenty stocks and there are 190 pairs, so about nine or ten will pass with no home at all. A pair picked as the best of many and judged on the same days is the look ahead bias from the intuition module, only larger.

Worked example: the pair lab on its default settings

The pair lab regresses Bank Nifty on Nifty over every session from 1 Jul 2025 to 15 Sep 2026, fits the ratio on the first sixty percent, and holds it fixed on the rest. Here is the picture first, then the numbers.

Two indices that share stocks, and a gap that did not stay put

Nifty 50 and Bank Nifty closes rebased to a common start with the rolling z score of their log spreadUpper panel: Nifty 50: from 100 at 1 Jul 2025 to 91 at 15 Sep 2026, high 103 at 2 Jan 2026, low 87 at 30 Mar 2026. Nifty Bank: from 100 at 1 Jul 2025 to 97 at 15 Sep 2026, high 107 at 18 Feb 2026, low 87 at 30 Mar 2026. Lower panel: z-score of the spread, with 27 readings beyond 2 standard deviations.Both rebased to 100 at the startNifty 50Nifty Bank9095100105z score of the spread, in standard deviations01−12−2Jul 2025OctJan 2026AprJul
Nifty 50 and Bank Nifty closes from 1 Jul 2025 to 15 Sep 2026, rebased to a common start, with the z score of the log spread over a rolling window of 60 sessions. The rolling window forgets a slow drift, so it understates how far the gap strayed. Source: NSE end of day data, computed by RupeeCase. As of 15 Sep 2026.

Every span of the spread stayed short of the Engle Granger cutoffs

Dickey Fuller statistics of the Bank Nifty on Nifty spread: minus 1.49 on the full sample, minus 0.67 on the fitted span and minus 1.08 on the held out span, all short of the Engle Granger cutoffs of minus 3.04, minus 3.34 and minus 3.90Engle Granger 1% −3.90; Engle Granger 5% −3.34; Engle Granger 10% −3.04; Full sample −1.49; Fitted span −0.67; Held out span −1.08.Dickey Fuller statistic; more negative is strongerEngle Granger 1%-3.90Engle Granger 5%-3.34Engle Granger 10%-3.04Full sample-1.49Fitted span-0.67Held out span-1.08
Statistic for the full sample, the fitted span to 19 Mar 2026 and the held out span after it, against the three Engle Granger values. A bar must reach the grey ones to count as a rejection. Source: NSE end of day index closes, computed by RupeeCase. As of 15 Sep 2026.
Read 2 more paragraphs, 120 words

Step one on the formation window, the first sixty percent of sessions to 19 Mar 2026, gave a hedge ratio near 1.07. Step two gave a statistic well short of any cutoff. Held fixed over the remaining sessions, the spread did no better. Refitting the ratio on those sessions alone moved it by more than a quarter, a sign of how loosely the pair is tied.

The half life told the same story from another side. On the fitted span it ran past a hundred sessions, about two thirds of the span it was fitted on. On the held out span it fell to about twenty three, which looks tempting until you notice the spread itself had not returned.

What the held out spread did

The more useful picture is the z score of the frozen spread, month by month. For the first two months it sat close to zero. From June it spent most sessions beyond two usual sizes, and at the last close it was still there.

After the split the spread drifted away from its fitted mean and stayed away

Z score of the frozen Bank Nifty on Nifty spread at the end of each month from 30 Mar 2026 to 15 Sep 2026, rising from near zero to above 2.530 Mar 2026 −0.06; 30 Apr 2026 0.36; 29 May 2026 0.73; 30 Jun 2026 2.57; 31 Jul 2026 1.43; 31 Aug 2026 2.52; 15 Sep 2026 2.70.Z score at each month end, ratio frozen on 19 Mar 202630 Mar 2026−0.0630 Apr 20260.3629 May 20260.7330 Jun 20262.5731 Jul 20261.4331 Aug 20262.5215 Sep 20262.70
Z score at each month end of the held out span, measured with the mean and spread of the formation window only. A z beyond two is the usual trigger, and here it arrived and did not leave. Source: NSE end of day index closes, computed by RupeeCase. As of 15 Sep 2026.
Read one more paragraph, 93 words

A trader who entered at a z of two on 9 Jun 2026, the first session beyond it, would have seen a wider gap at three of the four later month ends. The held out test counted one stretch beyond two and no return through zero. Rolling windows of 60 sessions, stepped five sessions at a time, passed the five percent cutoff in two of 49 cases, about what chance alone gives. None of that is a verdict on every pair. It shows what the toolkit says when a pair has no rope.

One day, four readings

Back to the opening. The same last close, measured four ways:

One close, four z scores: the window is a choice

Z score of the Bank Nifty on Nifty spread on 15 Sep 2026 under four windows: 1.11 on all sessions, 0.82 on 120, 0.58 on 30 and 0.18 on 60All 300 sessions 1.11; Last 120 sessions 0.82; Last 30 sessions 0.58; Last 60 sessions 0.18.Z score of the spread on 15 Sep 2026, by windowAll 300 sessions1.11Last 120 sessions0.82Last 30 sessions0.58Last 60 sessions0.18
The spread is the same on 15 Sep 2026. Only the window used for its mean and usual size changes, and with it the reading. Source: NSE end of day index closes, computed by RupeeCase. As of 15 Sep 2026.

None of the four is beyond two. The lesson is the spread between the readings, not any of them. A rule that fires at a z of two needs its window written down before the data is seen, and tested on days it did not shape.

Where this meets India

The closes used here are index closes, which no one can trade directly. A real pair would use two futures, each rolling every month, each with a lot that cannot be split, and each with its own costs. The ratio the regression asks for is a continuous number, and the exchange sells lots. The next module, pair trading with Indian stock futures, works through lots, roll, physical settlement and costs. More than two series need a different test, and a hedge ratio that moves through time needs a different estimator. Both belong to later, more advanced lessons.

Read the chart yourself

Open the pair lab linked below and change the split from sixty to eighty percent. Note the fitted statistic, the held out statistic and the hedge ratio each time. Ask whether any setting passes on both spans. Then swap which index is y and repeat. If you find a setting that passes, ask how many settings you tried. Every extra try is another chance for luck, and the fair answer to a pass found by searching is to test it on a later period that the search never touched.

The common mistake

The claim: This pair passed the cointegration test, so the spread has to come back. A pass means that on one sample the spread looked more like a rope than a wandering path, at an error rate of one in twenty at the five percent level. Across many pairs some pass by luck. Relationships also change, and a ratio fitted on one window moved by over a quarter on the next. Ask for four things before taking a result seriously: Engle Granger values and not the plain table, a half life short against the sample, a ratio frozen on one window and judged on a later one, and the number of pairs that were screened to find this one. Even then a pair can break.

The RupeeCase terminal on sample data: Rank table: how does a dynamic allocation share out its money?
Watch in the terminal: how does a dynamic allocation share out its money? A short tutorial on sample data.

Key takeaways

  • Engle Granger regresses first, then tests the spread for a unit root.
  • Use the strict Engle Granger values, not the plain table.
  • Half life and z score both depend on the window you choose.
  • Swapping which price is y changes the ratio and the statistic.
  • Test many pairs and some pass by luck.

Two terms to hold on to from 18.7

Two terms to hold on to from 18.7Two terms to hold on to from 18.7. Engle Granger test: A two step test: regress one log price on another, then test the leftover spread for a unit root against strict values. Unit root: A spread that wanders with no home level. Rejecting it is evidence that the spread keeps returning.Engle Granger testA two step test: regress one log price onanother, then test the leftover spread for aunit root against strict values.Unit rootA spread that wanders with no home level.Rejecting it is evidence that the spread keepsreturning.
From the module glossary. Source: Module 18.7, Cointegration toolkit: Engle Granger, ADF, half life and z score.

Before you trade. Derivatives trading carries a high risk of loss. SEBI's study "Profitability of Individual Traders in the Equity Derivatives Segment (FY25 to FY26)" (August 2026) found that 87.7% of individual traders in equity F&O made net losses in FY26, with aggregate net losses of Rs 91,685 crore. Read the SEBI study