CEROnArray class is designed to calculate the Efficiency Ratio (ER) used in the Adaptive Moving Average (AMA).
Usage:
Init() method with the following parameter is called in the OnInit() function:
- int aPeriod - efficiency ratio calculation period.
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[] - data buffer for the indicator calculation;
- double aER[] - the buffer with the calculated value.
Additional methods:
- int BarsRequired() - returns the minimum number of bars for the indicator calculation;
- string Name() - returns the line with the indicator name.
Test_EROnArray.mq5 is a sample indicator showing CEROnArray class application. IncEROnArray file must be placed to MQL5\Include\IncOnArray of the terminal data folder (IncOnArray folder must be created).
