z-score
A z-score puts any value on a common scale: how many standard deviations it sits above or below the mean. Under a normal model it tells you how rare the value is.
01The formula
- how many standard deviations x is from the mean
- the value you observed, such as today's return
- the mean of the distribution
- its standard deviation
02See it move
03Where it is used
- Risk managerFlags days whose P&L is more than a few standard deviations from normal for review.
- Quant researcherStandardises signals so ones with different units can be compared and combined.
- Retail traderReads a spread or price that is far from its average in z terms as stretched.
04Why traders use it
A 3% move means little until you know the volatility. The z-score turns it into a size you can compare across assets and periods.
05Worked example
Today's return is −3.0% for an asset with mean 0.05% and daily volatility 1.2%. Its z-score is −2.54. Under a normal model a day this far out on that side happens with chance 0.55%, about one day in 181.
06How it is built
- Subtract the mean: is how far the value is from typical.
- Divide by to measure that distance in standard deviations.
- If is normal, is a draw from the standard normal, so (or ) is its tail chance.
07The common mistake
Using a z-score's tail chance for fat-tailed data. A z of −5 'should' happen once in millions of days under a normal, yet markets produce such days every few years.
08In Python and LaTeX
from scipy.stats import norm x, mu, sigma = -0.03, 0.0005, 0.012 z = (x - mu) / sigma print(round(z, 2), round(norm.cdf(-abs(z)), 4))
z = \frac{x - \mu}{\sigma}09Where it fits
Rather not code the maths yourself? Describe your trading idea and let AI build the bot.
Build a bot with AgenKitThe worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.