Good evening,
this is my first article in this beautiful community, so I hope you will appreciate the content and contribute by giving me suggestions for improvement in my trading!
The strategy based on the 5 min DAX is not mine but comes from a webinar of the famous Andrea Unger; It is based on the breakdown of the maximum or minimum of the first hour of trading (08: 00-09: 00 AM).
The strategy needs the “Dfactor” indicator which is attached at the end of the current post too.
DEFPARAM cumulateorders = false
DEFPARAM Flatbefore = 090000
DEFPARAM Flatafter = 220000
ncontr=2 //n contratti da comprare o vendere per posizione
x=1 //moltiplicatore della barra della prima ora
y=0.5 //dailyfactor da utilizzare
z=2 //percentuale guadagno da proteggere con stop in trailing
dailyfact, dayofw = CALL "Dfactor"
//mytrailstop=Supertrend[5,20]
//fiso valore moltiplicatore per determinare il livello di ingresso e del massimo/minimo della prima ora
moltipl=x
//individuo maz e minimo prima ora
if time = 080000 then
maxprimaora=High
minprimaora=Low
endif
if time > 080000 and time <= 090000 then
if High > maxprimaora then
maxprimaora = High
endif
if Low < minprimaora then
minprimaora = Low
endif
endif
// determino i valori di ingresso Long e Short
delta = moltipl*(maxprimaora-minprimaora)
ingressolong=maxprimaora+delta
ingressoshort=minprimaora-delta
// determino i valori di STOP LOSS sia long che short
stoplong = maxprimaora
stopshort = minprimaora
//verifico innanzitutto che il daily Factor sia minore di 0,75 e che non sia venerdì
if time <= 100000 then
if dailyfact < y and dayofw <> 5 then
// verifico se ho rotto max o min della prima ora
if High > ingressolong and not onmarket then
stopl=stoplong
buy ncontr contract at market
SET STOP LOSS stopl
elsif Low < ingressoshort and not onmarket then
stopl=stopshort
sellshort ncontr contract at market
SET STOP LOSS stopl
endif
endif
// se sono a mercato e sono in guadagno calcolo lo stop di protezione della percentuale di guadagno accumulato
if longonmarket and close > ingressolong then
ptiguadagno=ABS(Close-ingressolong)
guadagno=ptiguadagno*pointvalue
percguad=z*guadagno/100
elsif shortonmarket then
ptiguadagno=ABS(Close-ingressoshort)
guadagno=ptiguadagno*pointvalue
percguad=z*guadagno/100
endif
if onmarket then
SET STOP $TRAILING percguad
endif
endif