This automated trading strategy was posted by Nicolas 1 year ago for long side trade as example, starting from this example I’ve added short side, Trailing stop, and Donchian stop.
Below you will find link of the original version: “Cumulative RSI 2 periods strategy”.
The following variables can be optimized and adapted to volatily and time frame
Trailing Stop : TGL and TGS
Stop loss by Donchian channel: DC
Moving Average: AVG to open position above or below it
Period of cumulative summ of the RSI indicator value “CUMRSI”
Positions are opens at indicator value set, called “CUMRSI” , this could be optimized and adapted to volatily and time frame (Ex:IF Close>AVG AND CUMRSI<35 THEN BUY…)
The concept of the strategy it’s universal, and It could work for equity/indices/currencies.
This strategy could be used with cumulative order for long side. Below the result in the red graphic equity.
https://www.prorealcode.com/prorealtime-trading-strategies/cumulative-rsi-2-periods-strategy/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
//CSR strategy cumulative 2 periods //Author Nicolas 2016 - February //Optimizator Ale 2017 - May // cfd DAX 1 Daily // Spread 5 - 95% of Position open at 010000 am // Probacktest 10 years Tick by Tick DEFPARAM CumulateOrders = FALSE // Posizioni cumulate disattivate //indicator Period = 2 CUMRSI = SUMMATION[Period](RSI[Period](close)) AVG = average[100](close) AVGS = average[110](close) //initial lot initLOT = 1 //initial lot initLOT = 1 CUM=COUNTOFLONGSHARES<4 IF Close>AVG AND CUMRSI<35 AND CUM THEN BUY initLOT CONTRACTS AT MARKET ENDIF If LongOnMarket AND CUMRSI>65THEN SELL AT MARKET ENDIF IF NOT SHORTONMARKET AND Close<AVGS AND CUMRSI > 175 THEN SELLSHORT initLOT CONTRACTS AT MARKET ENDIF If SHORTONMARKET AND CUMRSI<120 THEN EXITSHORT AT MARKET ENDIF //TRAILING STOP TGL=25 TGS=15 if not onmarket then MAXPRICE = 0 MINPRICE = close PREZZOUSCITA = 0 ENDIF if longonmarket then MAXPRICE = MAX(MAXPRICE,close) if MAXPRICE-tradeprice(1)>=TGL*pointsize then PREZZOUSCITA = MAXPRICE-TGL*pointsize ENDIF ENDIF if shortonmarket then MINPRICE = MIN(MINPRICE,close) if tradeprice(1)-MINPRICE>=TGS*pointsize then PREZZOUSCITA = MINPRICE+TGS*pointsize ENDIF ENDIF if onmarket and PREZZOUSCITA>0 then EXITSHORT AT PREZZOUSCITA STOP SELL AT PREZZOUSCITA STOP ENDIF // DONCHIAN STOP once DC =25 IF LONGONMARKET THEN DC=40 ENDIF IF SHORTONMARKET THEN DC=30 ENDIF e= Highest[DC](high) f=Lowest[DC](low) if longonmarket then laststop = f[1] endif if shortonmarket then laststop = e[1] endif if onmarket then sell at laststop stop exitshort at laststop stop endif |
Share this
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 :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials
Thank you Ale, did you try it with othere indices other than the DAX?
Hi francesco
not yet, I have given a look..it seems that there are good possibilities with different markets I would open a topic so that we post our tests
Sounds good! pls indicate the variables to be optimized so that we can speed it up 🙂
Ciao
You can start with round value of the variables mentioned above… value as you know for each market
Wow this looks good! Thank you so much Ale for sharing!
Yes, please open a Forum Thread for tests / discussion etc with a link from here.
Best RegardsGraHal
Hi Ale, good work. The RSI 2 periods is one of my favourites and I too modified and added some variables to my liking from the original. I run it on the S+P and it works well. I notice that you ran multiple passes for WF. With such limited trades, I’d be interested in the results from a standard one pass 70/30. What do you think?
Hi cosmic
I’m study this indicator just in these days.. I hope to discover some of interesting !! I’ve starting a topic for further discussion, if you know well please suggest!!
Hello Guys,I’ve starting new topic
Thanks for your attention, we can help each other always
http://www.prorealcode.com/topic/csr-strategy/
Hello GuysI’m trying to fix a problem that I missed during the probacktest, I update you as soon as possible on the topic
The code has been updated in the attachment of the post with the last version which contain the fix. So you can download it here to get the good version too.
Thanks as always Nicolas
It looks very interresting. I have one question related to the following result in ProbackTest with Spread=5 on DAXmini 1 EUR CFD (tick bt tick “on”) :
– if the period of the test is from 01/01/2013 00:00 to 01/03/2013 00:00, the Long trade taken on 6/02/2013 01:00 ends on 10/02/2013 21:00 with -13.30€ (loss)
– if the period of the test is from 01/02/2013 00:00 to 01/03/2013 00:00, the Long trade taken on 6/02/2013 01:00 ends on 07/02/2013 01:00 with -73.80€ (loss)
Does that mean that in that code, the previous trade taken in January 2013 (on the 17th) affects the behaviour of the code in February 2013 ?
Or what ?…
I am actually asking the question as in general I am wondering if it is better to :
– let the code run by prolongating the period of activity of the strategy in PRT (but isn’t there a risk here that after a certain number of executions, the code automatically stops ?)
– or to stop and start again the code from time to time (for example, each month)
Many thanks in advance for your comments/answers.
BR,
I tried running this on IG ProRealTime and get the following error message, why could this be? Total beginner, sorry 🙂
“Your ProBacktest exceeds the limit of repetitions for walk forward optimization.”
Any idea how I can fix this?
I tried it on dax 1D and I did not get any trades. Shifted to 10H and it started working. Would you have any idea on why that is?
I have the same problem
Is this working?