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/
//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
You must be logged in to post a comment.
Is this working?
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?
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,
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?
Sounds good! pls indicate the variables to be optimized so that we can speed it up :)
Ciao
Is there a ProRealCode indicator behind this strategy?