Technical Analysis  Technical Indicators  Trends Indicators  Standard Deviation

Analyze with the

Standard Deviation (StdDev)

Technical indicator named Standard Deviation (StdDev) measures the market volatility. This indicator charactrizes the scale of price changes relating to the Moving Average. Thus, if the indicator value is large, the market is volatile and the bars prices are rather dispersed relating to the moving average. If the indicator value is not large, it means that the market volatility is low and the bars prices are rather close to the moving average.

Normally, this indicator is used as a constituent of other indicators. Thus, when Bollinger Bands is calculated, the value of the symbol standard deviation is added to its Moving Average.

The market behavior represents the interchange of high trading activity and languid market. So, the indicator can be interpreted easily:

  • 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.



StdDev (i) = SQRT (AMOUNT (j = i - N, i) / N)


AMOUNT (j = i - N, i) = SUM ((ApPRICE (j) - MA (ApPRICE (i), N, i)) ^ 2)


StdDev (i) — Standard Deviation of the current bar;
SQRT — square root;
AMOUNT(j = i - N, i) — sum of squares from j = i - N to i;
N — smoothing period;
ApPRICE (j) — the applied price of the j-th bar;
MA (ApPRICE (i), N, i) — any moving average of the current bar for N periods;
ApPRICE (i) — the applied price of the current bar.

Source Code

Full MQL4 source of Standard Deviation is available in the Code Base: Standard Deviation

Warning: All rights on these materials are reserved by MetaQuotes Software Corp. Copying or reprinting of these materials in whole or in part is prohibited.