A 20-point drop on ES means a lot on a quiet morning and very little after a jobs report. The StdDev / Z-Score node measures a move in the series' own terms: how many standard deviations the current value sits from its recent average. Minus two is a stretch whatever kind of day it's been.
- Takes
- One series: an indicator, a price, a level, price action, a memory or another modifier
- Gives
- The z-score of the current value, or the window's standard deviation
- Reach for it
- A rule is about how stretched a value is, measured against its own volatility
How it works
The node looks at the last N values, the bar your rules are reading included, and gives you one of two outputs.
Z-Score, the default, is (current value − window average) ÷ window standard deviation. Zero is right on the average, +2 is two deviations above it, and the sign tells you which side you're on.
Std Dev is the standard deviation itself, in the input's own units: points for ES and NQ closes, dollars for a stock, RSI points for an RSI. It's the population kind, divided by N rather than N − 1.
If you've used Bollinger Bands, you already know this arithmetic. A 20-period z-score of the close above 2 is the same test as the close above the upper band of Bollinger Bands (20, 2): the same 20 closes, the same average, the same deviation. The z-score hands you the number instead of the line, so you can ask for 2.5, rank it, or use it on something that isn't price at all.
Two edge cases are worth knowing. A window that hasn't moved has no deviation, and the z-score there is empty rather than infinite. And because the current value is part of its own window, a z-score can only stretch so far: never more than √(N − 1). On 5 bars that's 2; on 10 bars, 3.
The input is any series the engine builds before the first bar: an indicator or one of its outputs, Current Price (read as the close of each completed bar), a price-action output, an external data source, a level (Price History, Pivot Levels, Event Day or Bands), a Distance in standard deviations, a Since or Capture, a Crossover on the Bar close clock, or another modifier. Math nodes, Constants and State Machines won't connect.
Z-score or Distance in standard deviations?
The Distance node has a Std dev unit, and the two are easy to mix up. They answer different questions.
| StdDev / Z-Score | Distance, Std dev | |
|---|---|---|
| Reads | One series | A value and a reference |
| Measures | The value against its own N-bar average | The gap between the two, against that gap's own last N values |
| Current Price | Reads its completed closes | Refused as the live price: both inputs must be completed-bar values |
Wire a fast and a slow EMA into Distance and it tells you whether today's spread between them is unusual compared with recent spreads. That's a different number from this node's z-score of the close, even with the 20 SMA as the reference. If you mean "two standard deviations from the average" in the Bollinger sense, this is your node.
Example: fade a two-sigma stretch
Say you trade mean reversion on ES 5m: when a bar closes far below where price has been trading, you buy and expect a snap back toward the average.
Wire Current Price into a StdDev / Z-Score node, Period 20, Output Z-Score. Feed it into a Comparison: Less Than, Constant -2, and into a long Entry. Entries become possible once a bar closes more than two standard deviations below the average of the last 20 closes.
The exit can mirror the idea: a second Comparison, z-score Greater Than 0, into a Set Exit Condition, closes the trade once price is back at its average.
Settings
Use something else when
When it doesn't behave
My threshold of 2.5 never fires
Check the period. With the current value inside its own window, the z-score tops out at √(N − 1): 2 on 5 bars, 3 on 10. A 5-bar z-score can't reach 2.5 however far price runs. Lengthen the window or lower the bar.
It buys again and again all the way down
"Z-score below -2" is a state, and in a real selloff it can stay true for an hour. Every time a trade closes, the condition is still sitting there. Trigger on the moment instead, with a Crossover of the z-score below -2, or pair the fade with a trend filter so it stands aside when the stretch is the start of something.
It's empty on some bars
The window had no spread. A series that sits on the same value for N bars (a count, a level that hasn't changed) has a standard deviation of zero, and we leave the z-score empty rather than divide by it. A Comparison against an empty value reads false.
Going further
The z-score works on anything with a center to come back to. A z-score of RSI asks whether momentum is unusual for this market right now, not against a textbook 70. The Std Dev output makes a decent volatility regime on its own, and a Percentile Rank Modifier on top of it turns "quiet" into a threshold that holds across years.
Period and Output both sweep. Be careful with the threshold most of all: -2 is a convention, -2.37 is a fit. Pick a round number you'd have chosen before seeing the results, and let the backtest tell you whether the idea holds rather than where the best decimal is.