# Percentiles, Quantiles and Z-Scores

> A z score shows how many standard deviations a value is from its mean. Learn the formula, its uses in mean reversion and pairs trading, and the pitfalls.

Source: https://learn.tradelabsai.com/math/z-scores/  
Track: Math and Statistics · Level: Intermediate · Updated: 2026-10-03  
Publisher: TradeLabs AI (https://tradelabsai.com). Education, not financial advice.  
Cite as: TradeLabs Learn, "Percentiles, Quantiles and Z-Scores", https://learn.tradelabsai.com/math/z-scores/

A z score tells you how far a value is from its average, measured in standard deviations. A z score of 0 means the value equals the mean; a z score of +2 means it is two standard deviations above; minus 1.5 means one and a half below. Z scores let traders compare moves across assets with different volatilities and spot unusual readings. They are the backbone of many mean reversion, pairs trading and anomaly detection strategies.

## The formula

```
z = (x - mean) / standard deviation
```

The mean and standard deviation are usually calculated over a rolling window, such as the last 20 or 60 days. See [Rolling and Expanding Windows](https://learn.tradelabsai.com/math/rolling-and-expanding-windows/).

## Worked example

**Example: A stretched stock**
A stock's price has averaged $50 over the last 20 days, with a standard deviation of $1.50. Today it closes at $46.40.

z = (46.40 minus 50) / 1.50 = minus 2.4.

The price is 2.4 standard deviations below its 20 day average, an unusually low reading. A mean reversion trader might consider buying, expecting a move back toward $50, if other conditions agree. See [Mean Reversion](https://learn.tradelabsai.com/strategies/mean-reversion/).

## Interpreting z scores

If values were normally distributed:

| Z score | Share of values beyond this level (one side) |
|---|---|
| 1 | About 16% |
| 2 | About 2.3% |
| 3 | About 0.13% |

Market data has fat tails, so extreme z scores occur more often than these figures suggest. A "3 sigma" move might happen several times a year rather than once every few years. See [Fat Tails](https://learn.tradelabsai.com/math/fat-tails/) and [Normal Distribution](https://learn.tradelabsai.com/math/normal-distribution/).

## Uses in trading

| Use | Example | Lesson |
|---|---|---|
| Mean reversion signals | Buy when z falls below minus 2, sell when it rises above +2 | [Mean Reversion](https://learn.tradelabsai.com/strategies/mean-reversion/) |
| Pairs and spread trading | Z score of the spread between two related assets | [Pairs Trading](https://learn.tradelabsai.com/strategies/pairs-trading/) |
| Comparing moves | A 3% move in a calm stock vs a volatile one | |
| Bollinger Bands | Bands at ±2 standard deviations are a visual z score | [Bollinger Bands](https://learn.tradelabsai.com/indicators/bollinger-bands/) |
| Factor scores | Standardising value or momentum signals across stocks | [Combining Signals](https://learn.tradelabsai.com/research/combining-signals/) |
| Anomaly detection | Flagging unusual volume or spreads | [Relative Volume](https://learn.tradelabsai.com/volume/relative-volume/) |

## Z scores of returns

Instead of prices, traders often compute z scores of returns:

```
return z score = today's return / standard deviation of recent returns
```

A 4% drop in a stock with daily volatility of 1% is a minus 4 move, extreme; the same drop in a stock with 3% daily volatility is only about minus 1.3. Standardising this way puts moves on a common scale.

## Cross sectional z scores

Quantitative strategies often standardise a signal across many stocks on the same day: subtract the cross sectional mean and divide by the cross sectional standard deviation. This turns raw values, such as earnings yields, into comparable scores that can be combined. See [Factor Investing Explained](https://learn.tradelabsai.com/research/factor-investing-explained/).

## Pitfalls

- **Fat tails:** extreme readings can keep getting more extreme.
- **Trending markets:** in strong trends, z scores can stay high or low for long periods; mean reversion trades fight the trend. See [Trend Following](https://learn.tradelabsai.com/strategies/trend-following/).
- **Window choice:** different lookbacks give different z scores; short windows react fast but are noisy.
- **Non stationary data:** if the mean and volatility drift, z scores lose meaning. See [Stationarity, Differencing and Unit Roots](https://learn.tradelabsai.com/math/stationarity/).
- **Outliers** in the window distort the mean and standard deviation. Robust versions use the median and median absolute deviation. See [Outliers and Robust Statistics](https://learn.tradelabsai.com/math/outliers-and-robust-statistics/).

## Frequently asked questions

### What is a z score?

A measure of how many standard deviations a value is above or below its average.

### How are z scores used in trading?

To identify unusual prices or spreads for mean reversion and pairs trading, compare moves across assets and standardise signals.

### Is a z score of 3 rare in markets?

Less rare than the normal distribution suggests, because market returns have fat tails.

Next, learn how assets move together in [Covariance and Correlation](https://learn.tradelabsai.com/math/covariance-and-correlation/).

## Continue learning

- Next lesson: [Covariance and Correlation](https://learn.tradelabsai.com/math/covariance-and-correlation/)
- Previous lesson: [Variance and Standard Deviation](https://learn.tradelabsai.com/math/variance-and-standard-deviation/)
- Related: [Variance and Standard Deviation](https://learn.tradelabsai.com/math/variance-and-standard-deviation/): Variance and standard deviation measure how spread out values are. Learn the formulas, sample vs population, annualising volatility and their role in trading risk.
- Related: [Mean Reversion](https://learn.tradelabsai.com/strategies/mean-reversion/): Mean reversion trades bet that prices stretched far from their average will come back. Learn the signals, z scores, examples and the risk of fading strong trends.
- Related: [Pairs Trading](https://learn.tradelabsai.com/strategies/pairs-trading/): Pairs trading buys one asset and shorts a related one when their spread stretches, betting it will converge. Learn pair selection, hedge ratios, z scores and risks.
- Related: [Normal Distribution](https://learn.tradelabsai.com/math/normal-distribution/): The normal distribution is the bell curve behind many financial models. Learn its properties, the 68 95 99.7 rule, where traders use it and why markets break it.
- Related: [Bollinger Bands](https://learn.tradelabsai.com/indicators/bollinger-bands/): Bollinger Bands place bands two standard deviations around a moving average. Learn the formula, the squeeze, walking the bands, %B and common trading strategies.
