Yes I know that problem. I might have found another oppertunity i Brent Oil. But my data is limited, so first I used the large contract- not the mini to get the most backtrack data. But still its only from nov 2015. perhaps someone could take a look in a 200000 sample platform. Here is the results.
//Brent Oil(LOC) - IG MARKET
// TIME FRAME 1H
// PROBACKTEST TICK by TICK - 100.000 bars
// SPREAD 1 point
// Elsborgtrading
// WF: not ancored- 5 Rep, in sample 70%, OOS 30% optimized in times of two pairs
// 1 pair
//Period of fractal level: CP= 40 to 50, 1 point
//Stop loss by Donchian channel: DC = 65 to 80
//2nd Pair
//Trailing Stop long: TGL = 5 to 15 , 1 point
//Trailing Stop Short: TGS= 5 to 15 , 1 point
//3rd pair
//TP 60 to 80 , 1 point
//SL 30 to 45 , 1 point
DEFPARAM CumulateOrders = false
Reinvest=0
if reinvest then
Capital = 50000
Risk = 1//0.1//in % pr position
StopLoss = 39//7//10 // Could be our variable X
REM Calculate contracts
equity = Capital + StrategyProfit
maxrisk = round(equity*(Risk/100))
MAXpositionsize=5000
MINpositionsize=1
Positionsize= MAX(MINpositionsize,MIN(MAXpositionsize,abs(round((maxrisk/StopLoss)))))//*Pointsize))))
else
Positionsize=1
StopLoss = 39
Endif
///BILL WILLIAM FRACTAL INDICATOR
//CP=PERIOD
CP=45
if close[cp] >= highest[2*cp+1](close) then
LH = 1
else
LH=0
endif
if close[cp] <= lowest[2*cp+1](close) then
LL= -1
else
LL=0
endif
if LH=1 then
HIL = close[cp]
endif
if LL = -1 then
LOL=close[cp]
endif
//LONG and SHORT CONDITIONS
//Positionsize=1
if (time >=100000 and time < 230000) then
C1 = (close CROSSES OVER HIL)
D1 = (close CROSSES UNDER LOL)
IF c1 and not shortonmarket THEN
BUY positionsize CONTRACT AT MARKET
ENDIF
IF D1 and not longonmarket THEN
SELLSHORT positionsize CONTRACT AT MARKET
ENDIF
ENDIF
//TRAILING STOP
TGL =14
TGS=5
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
DC=65
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
set target pprofit 78//TP//30
set stop ploss stoploss//*pointsize
//graph equity COLOURED(0,0,0) AS "equity"//black
//graph (((tradeprice-(tradeprice-((tradeprice*stoploss)/100)))*positionsize*pointvalue*100)/(equity))*100 COLOURED(0,0,0) AS "MAXRISK"
//graph (positionsize*stoploss/equity)*100 COLOURED(0,0,0) AS "MAXRISK"
graph (stoploss*positionsize/(equity+capital))*100 COLOURED(255,255,255) AS "MAXRISK"//Aqua
//Graph HIL COLOURED(0,200,0) AS "BREAKOUT LEVEL LONG"//HIL COLOURED(200,0,0) AS "BREAKOUT LEVEL SHORT"
Hi!
Tested it in 200k but didnt get so much more data. Full contract was the same data as you.?
Regards
Henrik
snippet for modulation of contract
n = 1+(ROUND((strategyprofit)/7500))
every 7500 € it adds a contract …. of course you could modify it
Hi Henrik you are using 1£ mini contract- but that should be the same. I was hoping for more years. it’s not statistically enough to rely on 1,5 years. sadly.
adds 1 contract every 2500 € and has max of 6 contracts .
Positionsize=1+(min (6,(ROUND((strategyprofit)/2500))))
FYI, it is now possible to have lots with decimal with IG. It is no longer needed to round up the contracts calculation.
ALEModerator
Master
@Nicolas, Thanks, I’ve attached screenshot with a little explanation to test other pairs, please correct me if I missing something..
ALEModerator
Master
@Kasper, I’ll test your brent value soon with 200.000 bars WF
Thanks!
@Kasper, this is cash contrakt, dont more data with that contrakt. do you @ALE?
@Ale where’s the screenshot? 🙂
ALEModerator
Master
Henrik I’ll test it later, sorry!
forgot to attach… here it is.
Hi everyone!
Here is code for optimizing with WF on 100k data with ALEs numbers from first page.
Regards
Henrik
@Henrik, so to be clear this is the code that everyone should now use to make their optimizations?