eurusd strategy that works for very long time on daily TF.
Walk forward parameters:
rangemin
pr
period
No walk forward on seasonality parameters. (day and month forbidden)
//-------------------------------------------------------------------------
// Main code : eurusd_TF_daily
//-------------------------------------------------------------------------
DEFPARAM cumulateOrders = False // Cumulating positions deactivated
///parameter definition
//inputs
rangemin = 3
pr = 170
period = 10
dayforbiddenlong =4
dayforbiddenshort = 2
monthforbiddenlong =1
monthforbiddenshort =4
//variables
mav = average[period](close)
oscillator = close-mav
rossa = (Dclose(0)-Dopen(0))<0
verde = (Dclose(0)-Dopen(0))>0
rangetoday = abs(Dclose(0)-Dopen(0))
//entry condition
cl = oscillator > 0
cl = cl and rossa
cl = cl and rangetoday > rangemin
cl = cl and dayofweek <> dayforbiddenlong and month <> monthforbiddenlong
cs = oscillator<0
cs =cs and verde
cs = cs and rangetoday > rangemin
cs = cs and dayofweek <> dayforbiddenshort and month <> monthforbiddenshort
IF cl THEN
buy 1 PERPOINT AT MARKET
ENDIF
if cs then
sellshort 1 perpoint at market
endif
//exit condition
set target pprofit pr
Hi Francesco! Been a long time since your last post 🙂 Thanks a lot for this new automatic trading idea.
I get almost the same result as you, but I need to understand something for a better comprehension, what is rangemin? Is is in pips? is it 3 or 30 pips?
With a PRT-CFD account, EURUSD is 5 decimals, so I guess we must adapt this value to the correct pip size?
I made this modification:
//-------------------------------------------------------------------------
// Main code : eurusd_TF_daily
//-------------------------------------------------------------------------
DEFPARAM cumulateOrders = False // Cumulating positions deactivated
///parameter definition
//inputs
rangemin = 30
pr = 170
period = 10
dayforbiddenlong =4
dayforbiddenshort = 2
monthforbiddenlong =1
monthforbiddenshort =4
//variables
mav = average[period](close)
oscillator = close-mav
rossa = (Dclose(0)-Dopen(0))<0
verde = (Dclose(0)-Dopen(0))>0
rangetoday = abs(Dclose(0)-Dopen(0))
//entry condition
cl = oscillator > 0
cl = cl and rossa
cl = cl and rangetoday > rangemin*pipsize
cl = cl and dayofweek <> dayforbiddenlong and month <> monthforbiddenlong
cs = oscillator<0
cs =cs and verde
cs = cs and rangetoday > rangemin*pipsize
cs = cs and dayofweek <> dayforbiddenshort and month <> monthforbiddenshort
IF cl THEN
buy 1 PERPOINT AT MARKET
ENDIF
if cs then
sellshort 1 perpoint at market
endif
//exit condition
set target pprofit pr
Below is the test with 30 pips.
Hi Nicolas,
I see your point, yes It should be 30 pips indeed, I have it quoted 12264.5-12265.0 and 3 is a variation of 3 of your 4th decimal digit.
I have uk account, pls see if with GMT it is more similar..
Many thanks!
Francesco
Hi Francesco
I took the liberty to optimize your code on IG prt eur/usd.
I also added a stop loss. A big chunk of the profit disappeared but the draw down is down 60%. I optimized it from year 2000 until today. Before is oos.
DEFPARAM cumulateOrders = False // Cumulating positions deactivated
///parameter definition
//inputs
rangemin = 5
pr = 70
pl = 80
period = 7
dayforbiddenlong =4
dayforbiddenshort = 2
monthforbiddenlong =1
monthforbiddenshort =4
//variables
mav = average[period](close)
oscillator = close-mav
rossa = (Dclose(0)-Dopen(0))<0
verde = (Dclose(0)-Dopen(0))>0
rangetoday = abs(Dclose(0)-Dopen(0))
//entry condition
cl = oscillator > 0
cl = cl and rossa
cl = cl and rangetoday > rangemin*pipsize
cl = cl and dayofweek <> dayforbiddenlong and month <> monthforbiddenlong
cs = oscillator<0
cs =cs and verde
cs = cs and rangetoday > rangemin*pipsize
cs = cs and dayofweek <> dayforbiddenshort and month <> monthforbiddenshort
IF cl THEN
buy 1 PERPOINT AT MARKET
ENDIF
if cs then
sellshort 1 perpoint at market
endif
//exit condition
set target pprofit pr
set stop ploss pl
@T-rader Cool, but that’s a range filter of about only 5 pips on a daily timeframe 🙂 What difference without it? I got almost the same result as you, but without the tick by tick option.
Below is the result I have with the tick backtest and a spread of 2 pips. Timezone is UTC 0 (default forex timezone).
Tick to tick shouldnt matter right? we dont have stop and profit on the same candle. yes I agree its a bit weird to have e pips filter.You can set it to zero but the results will be worst. The point of this strategy is that is working since 1980.
.
I might have been a little bit quick there. I tested it with 1p spread but now with 2p spread the differens between tick by tick and not tick by tick is a bit bigger…
Tick to tick shouldnt matter right? we dont have stop and profit on the same candle.
Why? I got many “zero bars orders” in the orders list.
voila’, I got rid of 2 parameters (rangemin and pr ), no zero bars now
//-------------------------------------------------------------------------
// Main code : eurusd_TF_daily
//-------------------------------------------------------------------------
DEFPARAM cumulateOrders = False // Cumulating positions deactivated
///parameter definition
//inputs
period = 7
dayforbiddenlong =4
dayforbiddenshort = 2
monthforbiddenlong =1
monthforbiddenshort =4
//variables
mav = average[period](close)
oscillator = close-mav
rossa = (Dclose(0)-Dopen(0))<0
verde = (Dclose(0)-Dopen(0))>0
//entry condition
cl = oscillator > 0
cl = cl and rossa
cl = cl and dayofweek <> dayforbiddenlong and month <> monthforbiddenlong
cs = oscillator<0
cs =cs and verde
cs = cs and dayofweek <> dayforbiddenshort and month <> monthforbiddenshort
IF cl THEN
buy 1 PERPOINT AT MARKET
ENDIF
if cs then
sellshort 1 perpoint at market
endif
Well done!
The dd is too big for me personally but the code looks great.
Thanks Francesco, so in this version you don’t afford to loose until a new contrarian signal?
yes Nicolas, that is the case.
Nicolas do oyu think we can post this last version in the library?
Thank you
yes Nicolas, that is the case.
Ok, so that explain the large drawdown.
Nicolas do oyu think we can post this last version in the library?
Yes, just after a quick review 😉