This automated trading strategy is about the breakout of Bill Williams fractals levels. It works well with EUR/USD pair on 1 hour time frame.
The following variables can be optimized:
Period of fractal level: CP= 110 to 114
Trailing Stop long: TGL = 5 to 15
Trailing Stop Short: TGS= 5 to 15
Stop loss by Donchian channel: DC = 15 to 30
Take profit : TP= 15 to 80
The concept of the strategy it’s universal, and It could work for equity/indices/currencies, with all time frame above 15 m
//EURUSD(-) - IG MARKET
// TIME FRAME 1H
// PROBACKTEST TICK by TICK - 200.000 bars
// SPREAD 0.6 PIP
// ALE
DEFPARAM CumulateOrders = false
///BILL WILLIAM FRACTAL INDICATOR
//CP=PERIOD
CP=113
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
// RETURN, HIL COLOURED(0,200,0) AS "BREAKOUT LEVEL LONG",HIL COLOURED(200,0,0) AS "BREAKOUT LEVEL SHORT"
//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 =5
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=20
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 30
You must be logged in to post a comment.
Hi ALE, would you be able to provide the values for the below part of the code (time >=100000 and time < 230000) , my time zone is Australia Perth. thanks
Ciao ALE. Recentemente sono passato a ProRealTime da VisualTrader e sto cercando di imparare la programmazione..... Sto studiando il tu Trading System con le modifiche di Elsborgtrading. Chiedevo per favore se potevi spiegrami perchè ci sono giorni interi in cui il sistema non entra in posizione e cosa significano queste due righe di codice "Capital = 10000" e "MAXpositionsize=5000 MINpositionsize=1". Grazie
oh yes I forgot : dc = 18 :)
Hello Ale, What do you think of ? : cp = 115 tgl = 1 tgs = 25 have a good day Nico
Hi, Im new to this forum and automated trading, so please excuse the nooby question:
If you have a trailing stop active why is the losses so high? $443 average loss??
Bonita estrategia. Gracias ALE
Thank you Ale, great code
Vue du rapport du Backtest https://ibb.co/8BMrBz6