Thursday, November 11, 2010

RSI Predictor for Amibroker

I trade a few systems that trigger entry and exits based on specific RSI levels. Often times I am trading on a close to close basis and need to know what stock price must be reached in order to trigger a particular RSI value. For example, if I want to buy a stock or ETF on the close today if the RSI(2) is below 50. How do I know what stock closing price will trigger a RSI(2) <= 50?

Below is Reverse Engineer RSI code I found. [Note: I did not write this myself. I wish I did, but I am not that good. I also wish I could give the person credit for creating it, but I spent a great many hours searching Google and user groups for this, and frankly can't remember where I got it.]


Value = 59.20;
WildPer = 2;
ExpPer = 2 * WildPer - 1;
AUC = EMA( Max( C - Ref( C, -1 ), 0 ), ExpPer );
ADC = EMA( Max( Ref( C, -1 ) - C, 0 ), ExpPer );
x = (WildPer - 1) * ( ADC * Value / (100-Value) - AUC);
RevEngRSI = IIf( x >= 0, C + x, C + x * (100-Value)/Value );

Filter= 1;

AddTextColumn(FullName(), "Full Name");
AddColumn(RSI(2), "RSI(2)");
AddColumn(C,"Close",6.2);
AddColumn(RevEngRSI, "RSI Predict");
"Value" is the desired RSI value.
"WildPer" is the RSI periods.


In this example, $SPY is trading at 121.61 on 11/9/10. If I want to sell it on the close 11/10/10 when the RSI(2) is 59.20 or higher, what will the stock price need to be to reach that level? It's 122.10.

If you are a trader that can't be around at the end of the day, you can place a limit-on-close (LOC) order for 122.10 and you're done.

Without this tool, traders who would like trade on the close usually must resort to trading on the next day's open. No more!

[Now I hope it possible to to this for David Varadi's DV Indicators . My gut says it isn't because most of the indicators (at least the one's I've seen code for) utilize high, low and close values. Wishful thinking.]

3 comments:

Anonymous said...

you mean "to sell it on the close 11/11/10"

Anonymous said...

Thank you so much for this!!

Rajesh Sanghrajka said...

Good one buddy..

Post a Comment