Reverse RSI indicator

I haven't found this indicator mentioned in the forum, but it sounded helpful. It lets you know what price must be reached in order to trigger a particular RSI value. For example, if you want to buy a stock at close if the RSI(2) is below 50. How do I know what stock closing price will trigger a RSI(2) <= 50? This could be useful when you have a system which buy or sell a stock on specific RSI threshold.

Here's a link to the author's paper.

I found code for other platforms that may help. This one is from tradestation:

inputs:
RSIValue( 50 ),
WilderTimePeriod( 14 ) ;
variables:
ExpPer( 2 * WilderTimePeriod - 1 ),
AUC( 0 ),
X( 0 ),
RevEngRSI( 0 ) ;
AUC = XAverage( IFF( C > C[1], C - C[1], 0), ExpPer ) ;
ADC = XAverage( IFF( C[1] > C, C[1] - C, 0), ExpPer ) ;
X = (WilderTimePeriod - 1 ) * ( ADC * RSIValue
/ ( 100 - RSIValue ) - AUC ) ;
RevEngRSI = IFF( X >= 0, C + X, C + X *
(100-RSIValue)/RSIValue) ;
Plot1[-1]( RevEngRSI ) ;


Amibroker:

///////////////////  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()<nLen-1, Null, 100*rsGain/(rsGain+rsLoss));    targetPrice = IIf( (rsiTarget < RSI(nLen)),
C-100*(((nLen-1)*rsGain)/rsiTarget)+((nLen-1)*rsGain)+((nLen-1)*rsLoss),
C+((rsiTarget/(100-rsiTarget)*((nLen-1)*rsLoss))-((nLen-1)*rsGain))
);
return targetPrice;
}

Filter = TRUE ;