Skip to main content
All posts

What is a Z-Score? Definition, Formula, and Example

A z-score measures how many standard deviations a data point sits above or below the mean of its distribution, letting traders quantify how unusual a price, spread, or indicator reading is relative to its own history.

What is a Z-Score?

A z-score expresses any observation as the number of standard deviations between that observation and the mean of its dataset. A z-score of +2 means the value is two standard deviations above the mean; −1.5 means one and a half below. In trading, the z-score converts raw prices, spreads, ratios, or indicator values into a normalized scale, so "unusual" has a precise, comparable definition across instruments with completely different prices and volatilities. It is the statistical backbone of mean-reversion strategies, pairs trading, and most quantitative overbought/oversold signals.

How the Z-Score is Calculated

The formula is:

z = (x − μ) / σ

where x is the current observation, μ is the mean of the lookback window, and σ is the standard deviation over the same window.

In trading applications, the window is a rolling lookback — 20, 50, or 100 periods are common. For a price series, the 20-day z-score is:

z = (Price_today − 20-day mean of price) / 20-day standard deviation of price

Under a normal distribution, z-scores of ±1, ±2, and ±3 correspond to roughly the 84th, 97.7th, and 99.87th percentiles — a z of +2 or higher occurs about 2.3% of the time on either tail. Financial returns are fat-tailed, so extremes occur more often than the normal curve implies, but the z-score remains the standard unit of "how stretched is this move."

Worked Example

Take a pairs trade on KO and PEP. You construct the spread as the ratio of Coke's price to Pepsi's price and compute its rolling 100-day statistics. Suppose the ratio today is 0.352, the 100-day mean of the ratio is 0.340, and its standard deviation is 0.006.

z = (0.352 − 0.340) / 0.006 = +2.0

The spread is two standard deviations rich to its own history — a level reached only a few percent of the time. A mean-reversion trader shorts KO and buys PEP in equal dollar amounts, expecting the ratio to revert toward 0.340. The exit rule is mechanical: close when the z-score crosses back through zero, and stop out if it extends beyond +3, where the "relationship is broken" hypothesis becomes more likely than "the spread is stretched."

The same math powers Bollinger Bands — the upper band is simply the +2σ level, so touching it is identical to a z-score of +2 on price.

When Traders Use Z-Scores

  • Pairs trading and statistical arbitrage. Entry and exit thresholds are defined in z-score units (enter at ±2, exit at 0, stop at ±3).
  • Mean-reversion signals. A stock with a z-score of −2.5 on price is statistically stretched below trend; contrarian systems buy those extremes.
  • Cross-asset comparison. Z-scores put a 2% move in a low-vol utility and a 2% move in a biotech on the same scale — the biotech move may be ordinary, the utility move extraordinary.
  • Risk monitoring. Desks track z-scores of portfolio returns and factor exposures to detect regime shifts before they show up in P&L.

Limitations and Common Misconceptions

First, z-scores assume the lookback window defines a stable distribution. In a trending market, price sits far from its trailing mean for weeks, and a −2 z-score is not "oversold" — it is a downtrend. The z-score measures distance from the mean, not the probability of reversion; reversion only follows if the series is actually stationary.

Second, financial data is fat-tailed and non-normal. A z of 4 is a one-in-30,000 event under normality but happens regularly in real markets. Treating z-score extremes as near-impossible is how funds blow up on "six-sigma" days.

Third, the output is only as good as the window. A 20-day z-score and a 252-day z-score on the same stock routinely give opposite signals; there is no correct window, only the one matching your holding period.

Finally, a z-score is descriptive, not predictive. It tells you where the observation sits in history — nothing about what comes next.