Have not read the entire thread ( i will ) but enough to get the gist of it . Seems to be a lot of optimization of optomization which rarely ends well . The mother of all curve fits BUT . With just a brief look at the logic of the OP i think he has something and i would like to explore it .
Will clean up the code and get into the nuts and bolts of it , seems to be a bit of a regime filter base to it and i like that aspect . His initial curve is still pretty rocksolid and thats a decent positive after many months of OOS . Could be a good thing imo . I will be back
Thank you for all your enthusiasm and sharing around the original version of the code proposed by Balmora! Forks versions are inevitable and I encourage them, even if over-optimization is very often the cause of the abandonment of a project, it also allows to educate the nice programmers of automatic trading systems on this aspect which is the more important in this discipline! 😉
Hi everyone. Many thanks for sharing this amazing code. The v1 is running in test with very few changes and seems to work good. Indeed, seems very powerful with Dax M5. Not yet read the 39 pages…
PaulParticipant
Master
Hi
i’am looking at a variation on the trailing stop used in v2.
This modification has its upside (closing in on gains & quicker profit taking) and downside (missing out on a bigger ride because took profit to quick in hindsight) .
Didn’t test it yet live and don’t know if it’s 100% correct.
This is the part which is change on the top of the trailing stop code.
once steps=0.05
once minatrdist=3
once atrtrailingperiod = 14 // atr parameter value
once minstop = 10 // minimum trailing stop distance
if barindex=tradeindex then
trailingstoplong = 4 // trailing stop atr relative distance
trailingstopshort = 4 // trailing stop atr relative distance
elsif prezzouscita>0 then
if longonmarket then
if trailingstoplong>minatrdist then
if prezzouscita>prezzouscita[1] then
trailingstoplong=trailingstoplong
else
trailingstoplong=trailingstoplong-steps
endif
else
trailingstoplong=minatrdist
endif
endif
if shortonmarket then
if trailingstopshort>minatrdist then
if prezzouscita<prezzouscita[1] then
trailingstopshort=trailingstopshort
else
trailingstopshort=trailingstopshort-steps
endif
else
trailingstopshort=minatrdist
endif
endif
endif
PaulParticipant
Master
here’s it complete
// trailing stop atr [adjusted reset]
once enablets=1
once displayts=1
if enablets then
//
once steps=0.05
once minatrdist=3
once atrtrailingperiod = 14 // atr parameter value
once minstop = 10 // minimum trailing stop distance
if barindex=tradeindex then
trailingstoplong = 5 // trailing stop atr relative distance
trailingstopshort = 5 // trailing stop atr relative distance
elsif prezzouscita>0 then
if longonmarket then
if trailingstoplong>minatrdist then
if prezzouscita>prezzouscita[1] then
trailingstoplong=trailingstoplong
else
trailingstoplong=trailingstoplong-steps
endif
else
trailingstoplong=minatrdist
endif
endif
if shortonmarket then
if trailingstopshort>minatrdist then
if prezzouscita<prezzouscita[1] then
trailingstopshort=trailingstopshort
else
trailingstopshort=trailingstopshort-steps
endif
else
trailingstopshort=minatrdist
endif
endif
endif
//
atrtrail=averagetruerange[atrtrailingperiod]((close/10)*pipsize)/1000
trailingstartl=round(atrtrail*trailingstoplong)
trailingstarts=round(atrtrail*trailingstopshort)
tgl=trailingstartl
tgs=trailingstarts
//
if not onmarket or ((longonmarket and shortonmarket[1]) or (longonmarket[1] and shortonmarket)) then//or (longonmarket and condsell) or (shortonmarket and condbuy) then
maxprice=0
minprice=close
prezzouscita=0
endif
//
if longonmarket then//and not condsell then
maxprice=max(maxprice,close)
if maxprice-tradeprice(1)>=tgl*pointsize then
if maxprice-tradeprice(1)>=minstop then
prezzouscita=maxprice-tgl*pointsize
else
prezzouscita=maxprice-minstop*pointsize
endif
endif
endif
//
if shortonmarket then//and not condbuy then
minprice=min(minprice,close)
if tradeprice(1)-minprice>=tgs*pointsize then
if tradeprice(1)-minprice>=minstop then
prezzouscita=minprice+tgs*pointsize
else
prezzouscita=minprice+minstop*pointsize
endif
endif
endif
//
if onmarket and prezzouscita>0 then
exitshort at prezzouscita stop
sell at prezzouscita stop
endif
if displayts then
graphonprice prezzouscita coloured(0,0,255,255) as "trailingstop atr"
endif
endif
Above added as Log 191 to here …
Snippet Link Library
Does anyone use US100 V5 live?
I myself haven’t looked at it since September but see that it has been stable since then.
Hi all, with my broker (IG) on CFD, after several days of optimization in demo, at the moment where i wanted to push it to live, ProOrder tells me it needs a stop… The ‘customized’ trailing stop musn’t be well recognized. Has this subjet ever been evoked through the 39 pages ? Many thanks
That happen if you are on a limited risk account. All orders must have stoploss attached. I suggest you add a SET STOP PLOSS instruction at the end of the code.
That happen if you are on a limited risk account. All orders must have stoploss attached. I suggest you add a SET STOP PLOSS instruction at the end of the code.
Indeed thank you, i only added this instruction SET STOP PLOSS 100 at the end and my code is online. But a warning (cf. attached snapshot) tells me trailing stop are not allowed with risk limited contracts. Impossible to simulate with the proback test which gives me the same result with and without the final instruction SET STOP PLOSS 100. Only live could give me the answer… I push it live.
Have you asked IG to lighten the restrictions? The first and hardest limit forces guarantued stops but there is an inbetween level. Not sure what each level is referred as here.
ALZParticipant
Average
Juju,
limited risk account..
Ask IG by phone to change your current account by “Standard Account”…
Then, 😉
Good afternoon, I update the evolution of the strategy in the Nasdaq, it is working in real account, I am waiting for it to do 2 bad operations to increase a position, but it does not fail, I only carry a losing operation. Regarding the results of Strategy 6.1 on the Dax in November, I think it was an accident, a robot that has been making good numbers in a period of 32 months that is what gives the backtest does not stop working at night In the morning, I understand that if the market changes, it should progressively have worse results, but not always start losing. This month of December is in positive and the last operations are very good …. Good weekend and Merry Christmas!
Thanks Gubben and ALZ fit your replies. It seems to work with only adding a ploss at the end ! Which doesn’t prevent the custom trailing to work. A good week on DAX. I’m going to push US 100 v5 to live too.
Balmora, Many thanks for the geometric philosophy of your first idea of this bot, which is very “pure”.
Been running the us100 v5.0p and dax v5.0p since aug 14th.
The us100 has been doing really good. But DAX is still at a loss.
Are there any new versions of DAX that work better?