Hello, I have been using this automated system for over a year, with a couple of changes but overall useful and profitable on the DAX. It enters at Frankfurt market opening.
I want to share this with the community as I have been benefited too from the knowledge and good systems shared on the page.
Please feel free to test it and any improvements are very welcome.
N parameter can be used with 1.5 to 5.5
Also if anyone can perform the 200000 bar test as well, please do it so and share the results.
Many thanks
//ALPHA - Autor: David Somogyi
// Definición de los parámetros del código
DEFPARAM CumulateOrders = False // Acumulación de posiciones desactivada
// El sistema anulará todas las órdenes pendientes y cerrará todas las posiciones a las 0:00. No se permitirá ninguna nueva orden ni posición después de la hora "FLATBEFORE".
DEFPARAM FLATBEFORE = 090000
// Anular todas las órdenes pendientes y cerrar todas las posiciones a la hora "FLATAFTER"
DEFPARAM FLATAFTER = 140000
// Dias de la semana
IF DayOfWeek = 0 OR Dayofweek = 6 THEN
tradeok = 0
ELSE
tradeok = 1
endif
// Impide al sistema crear nuevas órdenes para entrar al mercado a aumentar el tamaño de la posición antes de una hora precisa
timeEnterBefore = time = 090000
timeEnterAfter = time <= 093000
//FDI (fractal dimension index) de 1.5 //
//N = 1.5
once fdi=undefined
if barindex >= n-1 then
diff=0
length = 0
pdiff = 0
hh=0
ll=0
FDI=0
HH = highest[N](close)
LL = lowest[N](close)
for Period = 1 to N-1 do
if (HH - LL) > 0 then
diff = (customclose[Period] - LL) / (HH - LL)
if Period > 1 then
length = length + SQRT(SQUARE(diff - pdiff) + (1 / SQUARE(N)))
endif
pdiff = diff
endif
next
if length > 0 then
FDI = 1 + (LOG(length) + LOG(2)) / LOG(2 * (N))
else
FDI = 0
endif
//First trade whatever conditions
// Condiciones para entrada de posiciones largas
MSLOW = ExponentialAverage[1](Momentum[2](close))
c1 = (Momentum[2] > MSLOW[1])
//Impulse = ROC[12](close)>0
c2 = (Close > PSAR)
PSAR = SAR[0.03,0.03,0.2]
//PSARlongtrendstop = PSAR < PSAR[1] and PSAR[2] < PSAR[1]
//Condiciones de entrada de posiciones cortas
//c3 = (Momentum[2] < MSLOW[1])
//c4 = (Close < PSAR[1])
positionsize = 3
IF not onmarket and (c1 AND c2) AND timeEnterBefore and timeenterafter and FDI<1.55 and tradeok =1 THEN
BUY positionsize CONTRACT AT MARKET
ENDIF
//IF not onmarket and (c3 AND c4) AND timeEnterBefore and timeenterafter and FDI<1.5 THEN
//SELLSHORT positionsize CONTRACT AT MARKET
// Condiciones de salida de posiciones largas
//IF longonmarket and BARINDEX-TRADEPRICE = 10 THEN
//sell at market
//ENDIF
//ENDIF
// Stops y objetivos
//
//SET target profit 30
SET stop ploss 54
endif