IncStdDevOnArray – library MetaTrader 5

CStdDevOnArray class is designed for calculation of Standard Deviation (StdDev) on indicator buffers.

Usage:

Init() method with the following parameters is called in the OnInit() function:

  • int aPeriod – indicator period;
  • ENUM_MA_METHOD aMethod – MA method.

Solve() method with the following parameters is called in the OnCalculate() function:

  • const int aRatesTotal is a rates_total variable from the OnCalculate() function parameters;
  • const int aPrevCalc – prev_calculated variable from the OnCalculate() function;
  • double & aData[] – Close data buffer for the indicator calculation;
  • double & aMA[] – intermediate buffer for the average value calculation;
  • double & aStdDev[] – the buffer with the indicator calculated value.

Test_StdDevOnArray.mq5 is a sample indicator showing CStdDevOnArray class application. IncStdDevOnArray file must be placed to MQL5\Include\IncOnArray of the terminal data folder (IncOnArray folder must be created).

CMAOnArray class from the IncMAOnArray file is needed for the proper work. It can be found here.

Alternative:  PriceDistribution - indicator MetaTrader 5

Standard Deviation is a value of the market volatility measurement. This indicator describes the range of price fluctuations relative to Moving Average.

Example of use of CStdDevOnArray


📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks