I found this code to double my size every loss. And after a win it reset size to standard.
I would like help to change code to do following:
after a loss, double next position, after another loss (two in a row) double again. After 3 losses in a row, go for 1.x times the size, after 4 losses, 1.x times the size etc. Up to 5 losses in a row.
once os=1 // ordersize - can be any number depending on account size.
once osa=os
once kax=15 //15
once teilung=2 //1.5 reducing the ordersize after winning trade
//once zl=2 // 2 Ziellevel. Quadrant wird in zl Teile geteilt, je weniger, desto höher das Ziel
//once mgr=60 // 40 Mindestgröße des Channels
once ff=2 //2.5 increasing ordersize after losing trade.
once maxcon=50// defing the maximum ordersize
if hour=8 and minute>45 then // default setting of parameters outside tradingtime
if strategyprofit>sp then // and if equity reaches maximum again.
os=osa
sp=strategyprofit
endif
start=0
endif
if date<>20161226 and date <>20161227 and date<>20161230 and hour>8 then // there may be more "bad"-days to be excluded..... not only christmas
if strategyprofit<strategyprofit[1] then // increasing ordersize when losing
os=os*ff
if os>maxcon then
os=maxcon
endif
endif
start=1
endif
if strategyprofit>strategyprofit[1] then // decreasing ordersize when winning
start=1
os=1 //teilung
if os<osa then
os=osa
endif
endif
There you go:
once os = 1 //ordersize - can be any number depending on account size.
once osa = os
once kax = 15 //15
once teilung = 2 //1.5 reducing the ordersize after winning trade
//once zl=2 // 2 Ziellevel. Quadrant wird in zl Teile geteilt, je weniger, desto höher das Ziel
//once mgr=60 // 40 Mindestgröße des Channels
once ff = 2.0 //2.5 increasing ordersize after losing trade. (for first 2 consecutive losses)
once ff2 = 1.2 //1.2 times the size after the THIRD consecutive LOSS
once ff3 = 1.4 //1.4 times the size after the FOURTH consecutive LOSS
once ff4 = 1.7 //1.7 times the size after the FIFTH consecutive LOSS (beyond 5 losses, stop increasing)
once maxcon = 50// defing the maximum ordersize
once losses = 0
if hour=8 and minute>45 then // default setting of parameters outside tradingtime
if strategyprofit>sp then // and if equity reaches maximum again.
os = osa
sp = strategyprofit
endif
start=0
endif
if date<>20161226 and date <>20161227 and date<>20161230 and hour>8 then // there may be more "bad"-days to be excluded..... not only christmas
if strategyprofit<strategyprofit[1] then // increasing ordersize when losing
losses = losses + 1
IF losses <= 2 then
os = os * ff
elsif losses = 3 then
os = os * ff2
elsif losses = 4 then
os = os * ff3
elsif losses = 5 then
os = os * ff4
endif
//if os>maxcon then
//os=maxcon
//endif
os = min(os,maxcon)
endif
start = 1
endif
if strategyprofit>strategyprofit[1] then // decreasing ordersize when winning
losses = 0
start = 1
os = 1 //teilung
//if os<osa then
//os=osa
//endif
os = max(osa,os)
endif
on those forbidden dates you are preventing losses from being tallied, is that a mistake or is it a desired behaviour?
thanks alot Roberto!! 😀
no, they were only a part of the original code, will delete it out of the code 🙂