CCCIOnArray class is designed for calculation of Commodity Channel Index (CCI) values on indicator buffer.
Usage:
Init() method with the following parameters is called in the OnInit() function:
- int aPeriod - indicator period;
- ENUM_MA_METHOD aMethod - MA calculation 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[] - data buffer for the indicator calculation;
- double aP[] - intermediate buffer for MA calculation;
- double aСС[] - the buffer with CCI calculated value.
Additional methods:
- int BarsRequired() - returns the minimum number of bars for CCI calculation;
- string Name() - returns the line with the indicator name;
Test_CCIOnArray.mq5 is a sample indicator showing CCCIOnArray class application. IncCCIOnArray 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.
Commodity Channel Index Technical Indicator (CCI) measures the deviation of the commodity price from its average statistical price. High values of the index point out that the price is unusually high being compared with the average one, and low values show that the price is too low.
