This is slightly different implementation of RSI using arrays. But, it also comes with a twist.
Formula for standard RSI can be found here: www.investopedia.com
If there is green candle, gain for the candle is equal to price movement from previous bar and loss for that candle is 0. Similarly in case of red candle, loss is considered to be movement from...