Hi everyone,
I am trying to simulate the MTF in an indicator. My strategy is running default in 5′, combined with 1 hour entry signals, given by an custom made indicator.
There is no problem whatsoever to run the strategy, but I would like to visualise the indicator (1 hour) at the same 5′ screen where the strategy is running.
How could I simulate the 1 hour candles in a 5 mins TF????. I know is a basic piece of code, but I cannot find any example in the forums.
Attaching the part of the indicator involved.
// AVERG DOWN indicator
defparam drawonlastbaronly= true
// parameters
rojo=open>close
// Determinición niveles GRID
IF time=020000 AND rojo THEN
levelZERO = close
ENDIF
IF time=030000 AND rojo AND NOT rojo[1] THEN
levelZERO = close
ENDIF
IF time=040000 AND rojo AND NOT rojo[1] AND NOT rojo[2] THEN
levelZERO = close
ENDIF
IF time=050000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] THEN
levelZERO = close
ENDIF
IF time=060000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] THEN
levelZERO = close
ENDIF
IF time=070000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] AND NOT rojo[5] THEN
levelZERO = close
ENDIF
IF time=080000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] AND NOT rojo[5] AND NOT rojo[6] THEN
levelZERO = close
ENDIF
IF time=090000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] AND NOT rojo[5] AND NOT rojo[6] AND NOT rojo[7] THEN
levelZERO = close
ENDIF
IF time=100000 AND rojo AND NOT rojo[1] AND NOT rojo[2] AND NOT rojo[3] AND NOT rojo[4] AND NOT rojo[5] AND NOT rojo[6] AND NOT rojo[7] AND NOT rojo[8] THEN
levelZERO = close
ENDIF
// levels UP
grid=20
profitdiario=10
levelfinal = level1up + grid*pipsize
level1up = levelZERO + grid*pipsize
levelprofit = levelZERO - profitdiario*pipsize
RETURN LevelZERO as "levelZERO", level1up as "level1up", levelfinal as "levelfinal", levelprofit as "levelprofit"
Thanks in advance,
Hi Pableitor,
Thanks so much!! I will check the code and will keep it for any future use 😉
Muchas gracias,
Juan