What Is the Standard Deviation Indicator in Trading?
What is the Standard Deviation indicator? It shows how far closes stray from their average: the formula, the divisor split, and why it has no fixed levels.
The Standard Deviation indicator is a single line in its own window under the price chart. It measures how far closing prices have strayed from their own moving average over the last N bars, so it tells you how much the market is moving and never which way. It has no overbought level, no oversold level and no fixed "high" number, because the reading comes out in the instrument's own price units.
A reading of 0.0012 means nothing until you say what you are comparing it with.
What does the Standard Deviation line show?
One line, plotted under price, that rises when closes are ranging far from their average and falls when they hug it. RoboForex describes the plot: it "appears in a separate window under the chart and has just one main line".
Because the formula squares distances before adding them, the output can never go negative. RoboForex again: the values "start with 0 and always remain positive, i.e. never drop under 0", and "The indicator does not show trend direction." Distance has no sign, so the line rises the same whether price is running up or down. It grows "regardless of the market direction, equally when the quotes are growing and falling."
Deepvue makes the same point from the other side: "Standard deviation sees all deviation as risk." A move in your favour and a move against you lift the line identically.
Where it gets filed varies, and MetaQuotes contradicts itself on its own page. The MetaTrader 5 menu tree puts Standard Deviation under Trend Indicators, a different folder from Bollinger Bands, while the first line of that same help page calls it the "value of the market volatility measurement". LiteFinance calls it "a trend indicator"; FBS calls it "a statistical measure of market volatility". None of that changes what the line computes.
Where is it in ChartLabs?
ChartLabs has it built in under the name Standard Deviation. Open the chart's Indicators menu, go to the Standard list, and it sits under the Volatility heading, which is where we think it belongs. It draws in its own pane below the price as a single line, with no level lines on the pane, since the formula gives nothing for a fixed level to mean.
Three settings: Length 5, Deviations 1 and Source Close. Length is the bar count, Source is the price the deviations are measured from, and Deviations multiplies the finished reading, so 2 draws the same shape twice as tall. Ours is the population form, dividing by N, the same divisor MetaTrader uses.
What does a reading of 0.0012 actually mean?
On its own, nothing. The reading is in the instrument's own price units, so it has no portable level, and two readings are comparable only within one symbol and one price era.
The published numbers show how wide that gets. LiteFinance works through a five-digit currency quote where the indicator's "maximum value in a horizontal range was 0.0009" and a breakout happens around 0.0011. Deepvue works through Apple's annual returns and prints a standard deviation of "46.90%". Same indicator, and one figure is nine ten-thousandths of a price unit while the other is 46.9 percentage points. They are not the same kind of quantity.
So a threshold you read on a web page cannot travel. Double the price of an instrument and its standard deviation roughly doubles with it: the measure sits, as Deepvue puts it, "on the same scale as the asset". GoCharting puts it in one line of its mistakes list:
Do not use the same expansion thresholds across all markets; calibrate to each instrument's historical readings.
In practice you never ask "is 0.0012 high?" You ask whether 0.0012 is high for this symbol, on this timeframe, against its own recent readings. The comparison has to be built into the rule.
On a chart: pick a lookback, say the last 100 bars of the indicator itself, and judge the current reading against that window instead of against a number. A line drawn across the indicator's recent highs does the same job, and RoboForex uses exactly that, "in the window a horizontal level through its nearest highs can be drawn". Either way the threshold comes from the instrument's own history, which is what makes it testable.
What is the Standard Deviation indicator formula?
From MetaQuotes' own help page:
StdDev (i) = SQRT (AMOUNT (j = i - N, i) / N)
AMOUNT (j = i - N, i) = SUM ((ApPRICE (j) - MA (ApPRICE, N, i)) ^ 2)
In words: take each bar's applied price, subtract the moving average, square the difference, add the squares over N bars, divide by N, take the square root. MetaQuotes calls N the smoothing period.
Why some sources divide by N minus 1
Both divisors are legitimate statistics, and the educational pages are split on which one to print. Dividing by N gives the population standard deviation, which is what MetaTrader plots. Dividing by N minus 1 gives the sample estimate, and FXOpen says why: "Add up all the squared deviations and divide by the number of prices minus one (this adjustment, known as Bessel's correction, is used for a sample)." FBS and EarnForex print N minus 1 without a reason.
The sample figure is always larger by a factor of the square root of N divided by N minus 1. On a 20-period setting that is about 2.6%, small enough to ignore when you are reading a line, large enough to matter if you are rebuilding it in a spreadsheet and wondering why your numbers do not match the platform. On five values the gap is about 11.8%.
A worked example with round numbers
Five closes, chosen to come out clean: 100, 104, 102, 106, 103.
| Close | Minus the mean | Squared |
|---|---|---|
| 100 | -3 | 9 |
| 104 | +1 | 1 |
| 102 | -1 | 1 |
| 106 | +3 | 9 |
| 103 | 0 | 0 |
The mean is 515 / 5, which is 103. The squared deviations add up to 20. Divide by N, which is 5 here: 20 / 5 = 4, and the square root of 4 is 2. That is the reading, and its unit is whatever the closes were quoted in.
Had we divided by N minus 1, 20 / 4 = 5, and the square root of 5 is about 2.236, which is 11.8% larger. A rule has to say which one your platform is giving you.
What are the default Standard Deviation settings?
Period 20, applied to the Close, with a Simple moving average. RoboForex gives all three: "Period... By default, it is 20", "Apply to... By default, it is Close", "MA method is the calculation method for the MA. By default, it is Simple." EarnForex says the same: "By default, the period is 20, the moving average used is Simple, and it is applied to the close." MetaQuotes' help page states no default.
The period is a number of bars, not a timeframe. A 20-period Standard Deviation on a 5-minute chart and a 20-period on a daily chart use the same setting and measure different things.
Not every platform starts at 20. ChartLabs starts at a Length of 5, which is TA-Lib's default, so set it to 20 if you want a reading you can hold against a MetaTrader one.
In MetaTrader the menu route is Insert, then Indicators, then Trend, then Standard Deviation. FBS notes it "is one of the default indicators in MetaTrader", so there is nothing to install.
Changing the period changes what counts as a high reading, so a period change invalidates any threshold you had already calibrated. To find out whether 20 suits what you trade, change that one number, re-run the same date range, and compare the same way both times.
How do you use the Standard Deviation indicator?
As a filter on when to apply a rule, not as a signal by itself. EarnForex states the limit plainly: "It does not generate trade ideas on its own."
Two uses turn up in the published material. The first is the range break. RoboForex: the signal "appears after the quotes escape from a range", and "Before the price escapes the range, the indicator line must be at its lows, and in the window a horizontal level through its nearest highs can be drawn. When the price escapes the range, STDev line also breaks through its level upwards, confirming the entry signal." FBS publishes the same idea in nearly the same words. GoCharting adds a timing note: "Avoid entering breakout trades before Standard Deviation actually begins to expand."
The second is the spike. When the line makes a visible high, RoboForex reads it as "quite a strong movement that provoked a surge in volatility". MetaQuotes' documentation offers the same logic in both directions, in two bullets:
- "if its value is too low, i.e., the market is absolutely inactive, it makes sense to expect a spike soon;"
- "otherwise, if it is extremely high, it most probably means that activity will decline soon."
Neither bullet gives a number, a level, or any word about the reading carrying the instrument's units.
One reading you will come across cannot be right: that a high line means the market is overbought or oversold. RoboForex says it, "The quotes have deviated from the average quite a bit, and the market is oversold/overbought", and publishes the reason it fails on the same page. A line that is always positive and rises identically whether price climbs or falls cannot tell one from the other. A big reading says price is far from its average. Nothing in the formula could say which side of the average price is on, because the deviations are squared before they are added.
Is the Standard Deviation indicator the same as Bollinger Bands?
No. Same arithmetic, two different objects. The bands put the number on the price chart as a distance either side of a moving average, so you read it against price. This indicator plots the number itself in its own window, so you read it against its own history.
MetaQuotes says as much: "Normally, this indicator is used as a constituent of other indicators. Thus, when calculating Bollinger Bands® one has to add the symbol standard deviation value to its moving average."
Deepvue gives the practical reason to watch the raw line even when you already chart the bands: zooming in on the deviation value "helps you spot when volatility expansion is starting", before price reaches a band.
It is also not the standard deviation channel, which is a drawing tool you fit by hand to a stretch of price and which draws lines a set distance either side of a regression line through it. And it is not the ATR, which is built from a different input, so a reading from one is not comparable with a reading from the other even on the same chart.
How do you backtest a rule that uses it?
Write the comparison into the rule before you start, then replay the range bar by bar. Because the reading has no level, "enter when volatility is high" cannot be tested: nothing in it can be checked against a chart. A testable version names five things.
- The period, as a number of bars.
- The comparison, fully specified. Either the current reading against its own last N readings, with N named and the test named, such as higher than any of the last 50, or a cross of a level drawn through the indicator's recent highs, with "recent" defined as a bar count.
- The bar you read it on. The value moves until the bar closes, so say whether the trigger is the close of the signal bar or the open of the next one.
- The direction rule. The indicator supplies none, so direction comes from somewhere else, named as precisely as the rest.
- The entry, the stop and the exit, as price rules.
Then take every trade the rule gives you, including the ones you would rather skip. That is what manual backtesting is for: the reading arrives with no knowledge of what came next.
A volatility rule tends to fire you into fast markets, where the gap between the price you wanted and the price you got is widest, so set commission and slippage per symbol before you start rather than after. In ChartLabs commission and slippage are set per symbol, and every trade's P&L, balances and analytics reflect them. Our guide to backtesting accuracy, slippage and data quality covers why that matters more on exactly these setups.
Count the trades, too. A filter that lets only a handful of setups through has been sampled, not tested. Our forex backtesting guide covers how many trades a test needs before its numbers mean anything.
For each trade, write down the date and direction, the entry, stop and exit prices, the result in R, the indicator's value at entry with its units, what that value was being compared with and what the comparison returned, which bar you read it on, and what supplied the direction. The comparison and its result are the two people skip. "0.0012" in your notes is useless on its own. "0.0012, the highest reading in 50 bars" is a record someone else could check.
What are the Standard Deviation indicator's limitations?
It lags. LiteFinance puts it in its own limitations list: "Lags. The price blue line may have already left the flat zone while the indicator says volatility is low." A moving average sits inside the formula, so the reading is always partly about bars that have already gone.
It has no direction, which means it can never be more than half a rule.
Outliers move it hard. Deepvue lists "Outliers can skew the reading" among its weaknesses, and FBS explains the mechanism: "outliers have a stronger effect on the standard deviation. This is especially true when you consider that the difference with the mean is squared". One violent bar can lift the line for a whole lookback window.
FXOpen explains the bell curve correctly, that in a normal distribution "roughly 68% of data should be within one standard deviation of the mean". Price is not normally distributed, so do not carry those percentages onto a chart as though the indicator guaranteed them.
Calibrating it on your own data
Calibration means one symbol, one timeframe, one date range, a comparison defined before the first bar, the signal bar named, every trade recorded, costs applied.
ChartLabs is a manual backtesting platform built for that. You replay historical charts bar by bar, take practice trades as the market unfolds, and review the result with commission and slippage included, with the Standard Deviation line on the pane while you do it. Data comes from Dukascopy, tick-level where it is available, cleaned to remove anomalies, with history reaching up to around 22 years on the oldest forex pairs and other instruments starting later.
One plan, $20 a month or $200 a year, everything included, with a 7-day free trial and no credit card to start: start your free trial.