Indicators: RSI levels rendered on price as bands

 

RSI levels rendered on price as bands:

RSI levels rendered on price as bands

RSI levels rendered on price as bands

Author: maximo

 

Hi Max,

Thank you very much for your RSI indicator.

It's an advantage to have the indicator inside of the chart window

and not in an extra window at the bottom.

However, when I compiled the mq4 file I got two warnings

referencing to the code in lines #63 and #64:

"possible loss of data due to type conversion    RSI_on_price.mq4"

The warnings are triggered because of the definition of the "wilders"
variable as a double type variable in line #50. However, when calculating
the moving averages iMA in line 63 and 64, for the third parameter
(i.e. moving average period) an integer variable is required.

So, for the sake of proper code I changed the type of the "wilders"
variable from double to integer, and the modified line #50 is now

int      wilders = Length*2-1;

This should not give any alteration to the outcome of the indicator code,
since the extern variable "Length" is defined as integer, anyway.
Thus, the calculation of the variable "wilders" will give an integer
value, too.

With this modification the code is compiled without any error or warning.

Reason: