IncPriceChannelOnArray – library MetaTrader 5

The CPriceChannelOnArray class is intended for calculation of the price channel on indicator buffers.

Usage:

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

  • int aPeriod is indicator period.

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

  • const int aRatesTotal is the rates_total variable from the OnCalculate() function parameters;
  • const int aPrevCalc is the prev_calculated variable from the OnCalculate() function parameters;
  • double aDataHigh[] is the buffer with the High data for the indicator calculation;
  • double aDataLow[] is the buffer with the Low data for the indicator calculation;
  • double & aUpper[] is a calculated value of the upper line of the indicator;
  • double & aLower[] is a calculated value of the lower line of the indicator;
  • double & aMiddle[] is a calculated value of the central line of the indicator.
  Zigzag R - indicator MetaTrader 4

Additional methods:

  • int BarsRequired() returns the minimum number of bars required for the indicator calculation;
  • string Name() returns a string with the indicator name.

The Test_PriceChannelOnArray.mq5 file is an indicator demonstrating how to use the CPriceChannelOnArray class. The IncPriceChannelOnArray file must be located in the MQL5\Include\IncOnArray directory of the terminal data folder (the IncOnArray folder must be created).

The market is often accelerates and decelerates its movements, so it’s not easy to draw the straight lines of support and resistance levels. The Price Channel Indicator draws the price channel, its upper and lower boundaries are determined by maximal and minimal prices for a certain period.

  The20sv0.20 - indicator MetaTrader 5

An example of using the CPriceChannelOnArray indicator


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