What it does
A z-score tells you how far a value is from its average in units of standard deviation. This oscillator applies that to price: a reading of +2 means price is two standard deviations above its recent moving average, and -2 means two below. The line turns red above the upper level and green below the lower level, so stretched conditions are easy to spot.
How it works
- Moving average (SMA) = average of the applied price over the lookback.
- Standard deviation = population standard deviation of the applied price over the same bars.
- Z-score = (price - SMA) / standard deviation. If the standard deviation is zero, the z-score is 0.
- Levels are drawn at +level, 0 and -level.
- Alerts check the last closed bar. "Beyond" alerts fire when the z-score crosses outside a level; "return" alerts fire when it crosses back inside.
Example (illustrative): with a 20-bar SMA of 1.0850, a standard deviation of 0.0020 and a close of 1.0890, the z-score is (1.0890 - 1.0850) / 0.0020 = 2.0.
The z-score is essentially the position of price within Bollinger Bands expressed as a number, which makes it easy to compare across symbols and timeframes.
How to use it
Mean-reversion traders watch for readings beyond plus or minus 2, which show price is stretched relative to its recent average, and then look for signs that the stretch is ending, such as the z-score returning inside the level. Trend traders read the same numbers differently: a market that holds above +1 for many bars is showing persistent strength.
Combine it with structure, for example a stretched reading into a known resistance area, and plan exits with the Risk Reward Calculator. Ranges and slower timeframes (H1 to D1) usually suit mean-reversion use better than fast trending markets.
Settings
| Input | Default | What it changes |
|---|---|---|
| Lookback | 20 | Longer lookbacks give a slower, smoother oscillator |
| Applied price | Close | Close, open, high, low, median, typical or weighted price |
| Extreme level | 2.0 | Position of the outer levels and colour changes |
| Alert on move beyond level | true | Alerts when the z-score leaves the band |
| Alert on return inside level | false | Alerts when the z-score comes back inside |
| Popup alerts / Push notifications | false | Delivery of the alerts above, once per bar |
Limitations
- Prices are not normally distributed, so readings beyond 2 or 3 happen more often than textbook statistics suggest.
- In strong trends the z-score can stay extreme for a long time; fading it can be costly.
- The SMA and standard deviation both move with price, so the z-score is relative to a moving baseline.
- The live bar's value changes until the bar closes.

