// Downloaded From https://www.WiseStockTrader.com // Provided as is by www.AlvarezQuantTrading.com /////////////////// Reverse RSI Calculator //////////////////////// // Determines the closing value of a stock need to reach a particular RSI value function ReverseRSI(nLen, rsiTarget) { gain = Max(C-Ref(C,-1), 0); loss = -Min(C-Ref(C,-1), 0); rsGain = IIf(BarIndex() < nLen-1,Null, IIf(BarIndex()==nLen-1, MA(gain, nLen), gain)); rsLoss = IIf(BarIndex() < nLen-1,Null, IIf(BarIndex()==nLen-1, MA(Loss,nLen), Loss)); rsGain = AMA(rsGain, 1/nLen); rsLoss = AMA(rsLoss, 1/nLen); RSIcalc = IIf(BarIndex()