DEFPARAM CumulateOrders = false
Defparam Flatbefore= 080000
Defparam Flatafter = 220000
A = 36
MHull = average[A ,7](close)
Bullish = MHull > MHull[1] and MHULL[1] < MHULL[2]
Bearish = MHull < MHull[1] and MHULL[1] > MHULL[2]
IF Bullish AND Not LongOnMarket THEN
B = range[1] * 0.35
BUY 1 CONTRACT AT CLOSE - B *pipsize limit// B = 35% del range candela precedente
S = (abs(close - low[1]) / PipSize) + 5
ELSIF Bearish AND Not ShortOnMarket THEN
C = range[1] * 0.35
SELLSHORT 1 CONTRACT AT CLOSE + C *pipsize limit// C = 35% del range candela precedente
S = (abs(close - high[1]) / PipSize) + 5
ENDIF
P = S * 2
SET STOP pLOSS S // massimo relativo precedente + 5 pip
SET TARGET pPROFIT P // 2 volte lo stop