Back to Community
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 ),  
ADC( 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 ;  
AddColumn(C,"Close");  
AddColumn(RSI(2), "RSI2");  
AddColumn(ReverseRSI(2, 30),"RSI30-Next Day Price",1.3);  
AddColumn(ReverseRSI(2, 70),"RSI70-Next Day Price",1.3);  

Not sure how easy it would to create a custom function to do this. It's certainly beyond my skills.

1 response

What is XAverage()? Maybe source code to see what it is?