Description:
CRSIOnArray class is designed for calculation of RSI (Relative Strength Index) values on indicator buffers.Usage:
Init() method with the following parameters is called in the OnInit() function:
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 the positive component;
- double aM[] - intermediate buffer for the negative component;
- double aPS[] - intermediate buffer for the smoothed positive component;
- double aMS[] - intermediate buffer for the smoothed negative component;
- double aRSI[] - the buffer with RSI calculated value.
- int BarsRequired() - returns the minimum number of bars for the indicator calculation;
- string Name() - returns the line with the indicator name.
Test_RSIOnArray.mq5 is a sample indicator showing CRSIOnArray class application. IncRSIOnArray 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 Relative Strength Index Technical Indicator (RSI) is a price-following oscillator that ranges between 0 and 100. A popular method of analyzing the RSI is to look for a divergence in which the security is making a new high, but the RSI is failing to surpass its previous high. This divergence is an indication of an impending reversal. When the Relative Strength Index then turns down and falls below its most recent trough, it is said to have completed a "failure swing". The failure swing is considered a confirmation of the impending reversal.
