Generic RSI2 with modified filter

Generic RSI2 with modified filter

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.

 

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Nicolas • 06/28/2017 #

    At least Wilko has post something in the library! 😉 Thanks for this one, another great source of inspiration for our fellow coders around here, on this new fork of the classic RSI2 strategy.

  2. Wilko • 06/28/2017 #

    I have to admit it was a difficult birth…. 😉

    • Nicolas • 06/28/2017 #

      I have to say that I have difficulty believing you, I see magnificent equity curves from you on Twitter 😀

  3. larouedegann • 06/28/2017 #

    t-y for your code Wilko
    And the short entry ?
     

  4. CKW • 06/28/2017 #

    Thanks Wilko,
    I tried it on shorter time frame like 15m, 1h, 4h.. vs Daily. Result seems better than Daily. Do I miss something here? e.g. Wallstreet 2 spread

  5. Francesco78 • 06/28/2017 #

    works wonderfully with the russel

  6. Francesco78 • 06/28/2017 #

    sorry for my ignorance on this indicator, but would it make sense to try to build one wich allow  short positions too?

  7. Wilko • 06/28/2017 #

    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!

  8. gabri • 06/28/2017 #

    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

  9. Wilko • 06/28/2017 #

    I’m happy my code snippet inspired some new thoughts! Thanks for the feedback!

  10. CKW • 06/28/2017 #

    Thanks Wilko. I modified your daily strategy to 4H and tested WF on Dow Jon with acceptable SL.
    Great sharing from you!

  11. Wilko • 06/28/2017 #

    Thanks!

  12. StantonR • 06/28/2017 #

    Got good results on ZAF 1hr timeframe

  13. Wilko • 06/28/2017 #

    Great!

  14. Wilko • 06/28/2017 #

    Thanks for letting the community know!

  15. Mattzi • 06/28/2017 #

    Hi Wilko! Is there a screener for this one? Trying to make one myself but cant seem to get it right. Thank you!

    • Wilko • 06/28/2017 #

      I am not familiar with the screener function, but I am quite certain it should be quite simple to adapt.

  16. Gubben • 06/28/2017 #

    @Wilko have you had a look at this again since MTF support? Heard you talk on Börssnack btw..

  17. Wilko • 06/28/2017 #

    @Gubben not really. It was something I posted to show that simpler is usually better. Hope you enjoyed Börssnack!

avatar
Register or

Likes

avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar avatar

+2 more likes

Related users ' posts
ak5hay2 Works like crazy on bitcoin. Use different timeframes. Thanks a lot Doc!!!
richyowen Hi, great code thanks. Very new to this forum. Is there a way to add a 100point target on an...
lisamitch50 Morning all, Just backtested on quite a few instruments, worked well on backtesting, but tel...
Matriciel
6 years ago
Alai-n Thanks...
Bard Thanks for sharing this Verdi55. More instructions from Larry Williams website (and a fea...
Nicolas
6 years ago
Jurik RSX
v10.3
Jurik RSX
3
Indicators
hartgeld Hallo Nicolas, ein sehr guter Indikator, vielen Dank! Leider rechnet er bei mir nicht die Pe...
rigel Hi Nicolas, have you coded the Jurik alone (as Mov. average)?
Nicolas 2 versions available in this indicator: https://www.prorealcode.com/prorealtime-indicators/a...
AG1 Thanks Nicolas Still a problem in line 29 Please take a look. thanks again Alex
Nicolas code is modified in the above post, use that one.
AG1 Still a problem in line 29 Please take a look. thanks again Alex
styrke Hello Nicolas, Nice screener, I appreciate the way you always try to condense at maximum th...
Nicolas There's no particular reason. RSI is widely use with its default period and results seems re...
MaoRai54 Hi, first of all Happy New Year. Well, I've inserted your indicator in DAX 1h but I cann...
Vinks_o_7 Hi Mao Happy New Year ! This is just an improved RSI where you plot a standard price momen...
Angel Perez Ciao Francesco. First of all thanks for the indicator and also fro the screener. I do have a...
PSIDIO Ciao to you all, I also have a question and would be very happy for a helpful comment. I a...
SpreadBetMH Hi there, I have V11.1. I get the Indicator but no Arrows on the price. Kind Regards...
Alai-n Ciao Francesco, sei ancora in giro?
Metodi97 This indicator is great but can someone create strategy based on the same indicator it will ...
Nicolas
6 years ago
TradeNavigator RSI
TradeNavigator RSI
10
Indicators
Nicolas Tutte le impostazioni che hanno la parola "period" sono quelle dedicate ai periodi di cambio...
GianfrancoCeck Le chiedo una ultima cosa, ossia se è possibile personalizzare l'indicatore con una scritta ...
Nicolas Spiacente che non sia possibile, le coordinate grafiche non sono in pixel ma nel prezzo e ne...
Madrosat Bonjour Nicolas la formule du stop loss est elle vraiment valable ?? il n'y a pas au depart ...
Nicolas Il y a peut-être un erreur en effet, essayer avec: set stop ploss (averagetruerange[14] * ...
Madrosat ok merci Nicolas c'est avec /pipsize que ça fonctionne
Marc Boliart dear nicolas, tyvm for your indicators and strategies, i have this following error when i ch...
Nicolas Your picture is too small, but for sure the problem is about the fact you are still using v1...
Rory Dryden Thanks. This looks useful.
Jessar Hello, could you tell me how to use this indicator? I think the simplest things can still be...
Mirko Vaglio Interesting idea to bypass the limit of PRT about multiple timeframe, and I am just trying t...
Mirko Vaglio Looking a little bit more, now I understand what had to be absolutely obvious from the first...
Seb nice code! I'm trying to use your method to do a higher timeframe EMA, without success yet. ...
Francesco78 @snucke the results are not the same because the pictures refers to a few years ago. I am no...
snucke @Francesco78 i mean the results differ when i test on my own. so im curious of what the p...
sfl still working, using with filters like : trendFilterUp=close>average[190](close) tren...
alex Im looking for a entry when EpicMA crosses over/under trigger. Then look for exits when Epic...
rejo007 hello david, i'll try it could you tell me wich strategy do you use in real? thanks
David Somogyi Hello, I have a couple of DAX strategies of breakout and mean reversion. I'll try to post...
Roberto Blázquez Hi David, I just saw your strategy and it's good!!! I'm going to try it from today in real a...
juanj To follow new developments or get the latest version of this strategy please visit the forum...
tahar Hello Juan, I wanted to test Universal Strategy via a demo account on PRT but nothing happen...
BravoDelta @juanj wondering if you may help me please. I am looking for a simply strategy to use on the...

Top