MetaTrader 5 β€£ MT5 Libraries β€£ IncRVIOnArray – library MetaTrader 5

IncRVIOnArray – library MetaTrader 5

CRVIOnArray class is designed for calculation of RVI (Relative Vigor Index) values on indicator buffers.

Usage:

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

  • int aPeriod – indicator period.
  • ENUM_MA_METHOD aMethod – smoothing 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 aDataOpen[] – the buffer with the Open data for the indicator calculation;
  • double aDataHigh[] – the buffer with the High data for the indicator calculation;
  • double aDataLow[] – the buffer with the Low data for the indicator calculation;
  • double aDataClose[] – the buffer with the Close data for the indicator calculation;
  • double aM[] – intermediate buffer for calculations;
  • double aMS[] – intermediate buffer for calculations;
  • double aR[] – intermediate buffer for calculations;
  • double aRS[] – intermediate buffer for calculations;
  • double aMain[] – buffer with the main line calculated values;
  • double aSignal[] – buffer with the signal line calculated values.

Additional methods:

  • int BarsRequiredMain() – returns the minimum number of bars for the main line calculation;
  • int BarsRequiredSignal() – returns the minimum number of bars for signal line calculation;
  • string Name() – returns the line with the indicator name.
Alternative:   The "New bar" event handler for the indicators - indicator MetaTrader 5

Test_RVIOnArray.mq5 is a sample indicator showing CRVIOnArray class application. IncRVIOnArray 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.

The main point of Relative Vigor Index Technical Indicator (RVI) is that on the bull market the closing price is, as a rule, higher, than the opening price. It is the other way round on the bear market. So the idea behind Relative Vigor Index is that the vigor, or energy, of the move is thus established by where the prices end up at the close.

Example of use of CRVIOnArray class


πŸ“ˆ ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks