Standard Deviation indicator explained: how to read it
By Oalgo · Last reviewed
The Standard Deviation indicator (StdDev) measures how far the last 20 closes are spread around their average. A small number means the closes sat close together, a large number means they were scattered. It does not say which way price is going.
How is Standard Deviation calculated?
#- Take the last 20 closes and find their average.
- For each close, find how far it is from that average and square the distance. Squaring makes every distance positive and counts large distances more.
- Add the squared distances up and divide by 19, which is 20 minus 1.
- Take the square root. That is StdDev.
- The first value appears on candle 20, the first time 20 closes exist.
What does a worked example look like?
#| Close | Distance from the average (100) | Squared |
|---|---|---|
| 100 | 0 | 0 |
| 102 | +2 | 4 |
| 98 | −2 | 4 |
| 101 | +1 | 1 |
| 99 | −1 | 1 |
The squares add up to 10. Divided by 4 (5 closes minus 1) that is 2.5, and the square root of 2.5 is 1.58. The window is shortened to 5 closes here to keep the sums short. The closes 100, 106, 94, 103 and 97 also average 100, but their StdDev is 4.74, because they sit further from the average.
How do you read Standard Deviation?
#StdDev is in the same units as price. A StdDev of 2 means the closes in the window sit roughly 2 price units from their average.
| What you see | What it suggests |
|---|---|
| Rising | Closes are spreading further from their average. Price is moving more. |
| Falling | Closes are bunching closer to their average. Price is calmer. |
| High compared with its own past | An active stretch. |
| Low compared with its own past | A quiet stretch. |
| A sudden jump | A large move has just entered the 20-candle window. The value falls again when that candle leaves it. |
It rises on a move up and on a move down alike. It measures closes around their average, so a steady climb raises it too, even when every candle is small. ATR measures the size of each candle instead.
How is it different from ATR and Bollinger Bands?
#| Part | StdDev | ATR |
|---|---|---|
| Measures | How far closes are spread around their average | How big candles are, including gaps |
| Uses highs and lows | No, closes only | Yes |
| A steady climb of small candles | Raises it | Stays low |
| Smoothing | None: a plain 20-candle window | Wilder's smoothing |
| Usual setting | 20 | 14 |
Bollinger Bands are built from this same number: the middle line is the 20-candle average and the outer lines sit 2 StdDevs either side of it.
How do people use Standard Deviation in rules?
#- Take entries only while StdDev is above a level you choose, so that price is moving enough to matter.
- Take entries only while StdDev is below a level, as a check for a quiet stretch before a possible larger move.
- Put it next to a trend indicator, so that one condition says which way price is going and the other says how much it is moving.
- Change the length. A shorter window reacts faster and jumps more. A longer one is smoother.
What can Standard Deviation not tell you?
#StdDev gives no direction, and a fall and a rise both raise it. Because it is in price units, a level such as 2 means something different on a chart where price is near 50 than where it is near 5,000, so compare StdDev with its own past on the same chart. One large move raises it for 20 candles and then drops out of the window all at once. Test any StdDev rule on past prices with a backtest, then forward test it.
In Oalgo you can tell Oalgo AI your StdDev rule in your own words, check the rule it builds, and test it. After testing, if you choose, you Go Live with your own Live Strategy on your own Venue Account at a Supported Venue.
Read next
- Bollinger Bands explained: how to read and use themBollinger Bands sit above and below a moving average and widen when price moves more. Learn how they are calculated, how to read them and how to test rules.
- What is ATR? Average True Range explainedATR measures how far price typically moves in one candle. Learn how it is calculated, how to read it, and how to use it in your own rules.