---
title: "How do I compute the half life and z score of a pair?"
description: "The spread of a pair is the series to study, its half life is the time a gap takes to close half way back to the mean."
source_url: "https://www.rupeecase.com/learn/questions/pair-half-life-and-z-score"
---

The z-score puts the spread in its own standard deviations, so one set of bands can be read across periods

Nifty 50 and BANKNIFTY closes, 1 Jul 2025 to 15 Sep 2026, with the z-score of their spread below (60 session window, hedge ratio fitted on the whole sample, which a real test must not do). The bands are choices, and this is an illustration, not a recommended pair. Source: NSE end of day data, computed by RupeeCase. As of 15 Sep 2026.
Start with the spread, not with either price. Fit the hedge ratio on a training window by least squares on log prices, then form the spread as one log price less the hedge ratio times the other, minus an intercept.

The half life comes from regressing the change in the spread on its lagged level. If the slope is negative, the half life is about minus the natural log of two divided by the slope, in sessions. The exact form is minus ln 2 over ln(1 plus the slope). A slope near zero or positive means there is no pull back at a usable speed on that sample.

The z-score is the spread minus its rolling mean, divided by its rolling standard deviation. A window of a few half lives is a common starting point, not a law. Entry at a large absolute z-score, exit near zero and a stop further out are conventions that depend on costs and the sample.

The chart shows the z-score of a Nifty and BANKNIFTY pair on a 60 session window, with one and two standard deviation bands. On this sample the fitted half life runs for most of the sample length, far past that window, and the Engle Granger test does not reject, so the spread shows no usable pull back and the window is only a drawing choice. A z-score is not a cointegration test.

Two cautions. Choosing the window and the bands on the same data that then tests the trade is look ahead in disguise. Lot size rounding and futures rolls also change the effective hedge, so a clean z-score on paper can trade differently in practice.

**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](https://www.sebi.gov.in/reports-and-statistics/research/aug-2026/study-profitability-of-individual-traders-in-the-equity-derivatives-segment-fy25-fy26-_103835.html)

How do I compute the half life and z score of a pair?The spread of a pair is the series to study, its half life is the time a gap takes to close half way back to the mean, and its z-score is the gap in units of its own recent standard deviation. These measures set the lookback, the entry band and the time stop, and each one is an estimate that changes with the sample.

LGo deeper

## Where Learn teaches this.
[Go deeperCointegration toolkit: Engle Granger, ADF, half life and z score10 min, Advanced](/learn/path-18/module-18-7-cointegration-toolkit)[Go deeperPair trading with Indian stock futures10 min, Advanced](/learn/path-18/module-18-8-pair-trading-with-stock-futures)

SSources

## Go to the source.
3 sources, NSE the most cited

The publisher of each source listed below. Source: Module undefined source list.
1. [Engle and Granger (1987), Co-integration and error correction, Econometrica](https://doi.org/10.2307/1913236) Paper
2. [NSE, equity derivatives contract specifications (lots, expiries and settlement used in the examples)](https://www.nseindia.com/static/products-services/equity-derivatives-contract-specifications) NSE
3. [SEBI, norms for sharing and usage of price data for educational purposes (30 day lag, from 8 May 2026)](https://www.sebi.gov.in/legal/circulars/may-2026/norms-for-sharing-and-usage-of-price-data-for-educational-purposes_101293.html) SEBI

?Questions people ask

## Related questions.
[QuestionWhat is statistical arbitrage?Advanced](/learn/questions/what-is-statistical-arbitrage)[QuestionWhat is pair trading, and is there an NSE pair trading stock list?Intermediate, trap check](/learn/questions/what-is-pair-trading)[QuestionMean reversion or momentum: what is the difference?Intermediate](/learn/questions/mean-reversion-vs-momentum)[QuestionHow do I backtest an option strategy in India, or in Python?Intermediate](/learn/questions/backtest-option-strategy)

[All 130 questions](/learn/questions/)

    Explore next

## Go deeper on this question.

* [QuestionHow do people pair trade in India without shorting stocks overnight?A short answer with a dated chart](/learn/questions/pair-trading-without-overnight-shorts)
* [QuestionCointegration or correlation: what is the difference?A short answer with a dated chart](/learn/questions/cointegration-vs-correlation)
* [ToolOption payoff builderLegs on a dated Nifty chain, breakevens and charges](/learn/tools/payoff-builder)
* [GlossaryInvesting glossary, 230 termsPlain word definitions, and the app’s own](/learn/glossary)

      Community

## Join my WhatsApp group.

      Scan the code, fillFill one short form, and join my WhatsApp group. Slides, sources, factsheets and the rebalance logs live there, and members join a daily Google Meet with me.

      New to RupeeCase? [Getting started](/getting-started) [See the terminal](/terminal)

        [Sign up for RupeeCase](https://invest.rupeecase.com/signup)
        [Join the WhatsApp group](https://forms.gle/C6HMtM1Z2GfeocQV7)

      [One form, one group](https://forms.gle/C6HMtM1Z2GfeocQV7)Scan with your phone camera

Education only, not investment advice, a research report or a recommendation to buy, sell or hold any security. RupeeCase (QC Alpha Technologies Pvt Ltd) is not registered with SEBI as an investment adviser or research analyst. Contracts and prices shown are for illustration only, come from NSE end of day files at least 30 days old, and are not recommendatory. Derivatives trading carries a high risk of loss.
