I have spent some time on the infamous RSI2 strategy. This is a well-recognized mean reversion strategy that has been posted previously on ProRealCode in various forms.
The rules are extremely simple to understand: Buy when 2-period RSI is below a certain threshold and sell when it has come back up again. The backside to the RSI2 strategy is you are exposed to negative asymmetry between max and average wins/losses, meaning every once in a while the market comes back and takes a big bite out of your profits, potentially big enough to wipe your account. In order to decrease that risk, it is often proposed to only employ the strategy when close remains above the 200 day moving average.
I propose to exchange the 200d MA for two rather simple conditions. Only employ when the slope of 22 day moving average is positive and a longer 22-period RSI remains above 50. I find these filters are an improvement on the original MA200-rule, although there is still a significant downside risk involved in this strategy.
I have only tested on IG CFDs, and it works quite well on most equity indices of developed markets. However, spreads on IGs 24h index CFDs at midnight (which is when daily strategies are executed on ProRealTime platform) will eat up much or most of the edge. Therefore I believe this strategy is best left until such time that ProRealTime allows access to two different timeframes from within the same ProOrder-strategy. I understand they are hard at work on this. In the meantime I provide the code as a potential source of inspiration.
ShortRSI = RSI[2](close)
LongRSI = RSI[22](close) //1 month RSI
MA = Average[22,0](close) //1 month moving average of close
Slope = MA/MA[1]-1 //Slope of 1 month moving average
MaxPos = 1 //Set to tolerated maximum position
LongEntry = CountOfLongShares < MaxPos //Buy until MaxPos reached
LongEntry = LongEntry AND ShortRSI < 15 //Buy when RSI2 below 15
LongEntry = LongEntry AND LongRSI > 50 //Filter for 1month RSI above 50
LongEntry = LongEntry AND Slope > 0 //Filter for positive slope of MA22
LongExit = LongOnMarket
LongExit = LongExit AND ShortRSI > 60 //Exit position when RSI2 above 60
// Conditions to enter long positions
IF LongEntry THEN
BUY 1 CONTRACTS AT MARKET
ENDIF
// Conditions to exit long positions
IF LongExit THEN
SELL AT MARKET
ENDIF
You must be logged in to post a comment.
Wilko,
great code!! I never worked with RSI2 and I found it very interesting. I made some change to the code and I got good results on the stock market. I used a SMA200 slope and a weekly RSI14 (approximated by a EMA130 in the code) to get better trend information.
ShortRSI = RSI[2](close) LongRSI = close>exponentialaverage[130](close)//RSI[22](close) //1 month RSI MA = Average[200,0](close) //1 month moving average of close Slope = MA/MA[1]-1 //Slope of 1 month moving average //MaxPos = 1 //Set to tolerated maximum position LongEntry = 1//CountOfLongShares < MaxPos //Buy until MaxPos reached LongEntry = LongEntry AND ShortRSI < 15 //Buy when RSI2 below 15 LongEntry = LongEntry AND LongRSI //Filter for 1month RSI above 50 LongEntry = LongEntry AND Slope > 0 //Filter for positive slope of MA22 LongExit = LongOnMarket LongExit = LongExit AND ShortRSI > 60 //Exit position when RSI2 above 60 // Conditions to enter long positions IF LongEntry THEN BUY 10000 cash AT MARKET ENDIF // Conditions to exit long positions IF LongExit THEN SELL AT MARKET ENDIF
Cheers
G
Thank you all for your comments! I treat shorting very separately from the long side, at least in long-term growth assets like equities. When shorting, one is in that case going against the long term trend, meaning you are skewing probabilities against yourself from the outset. This needs to be taken into account. Also, in my experience, assets behave completely different on the up- and downside. Therefore I generally tend to try to treat short different from long. But gereally speaking, if you can get it to perform on the short side, then please do!
If it works on 1hr timeframe, all the better! I did not get it to work, but I will test as suggested on the DOW.
Again, thanks for all your comments, and happy trading!
sorry for my ignorance on this indicator, but would it make sense to try to build one wich allow short positions too?
works wonderfully with the russel
@Gubben not really. It was something I posted to show that simpler is usually better. Hope you enjoyed Börssnack!