DEFPARAM CumulateOrders = False
ONCE HH = high
ONCE LL = low
Rialzista = close > open
Ribassista = close < open
IF Rialzista THEN
LL = low
ELSIF Ribassista THEN
HH = high
ENDIF
IF Rialzista AND Not LongOnMarket THEN
IF Ribassista[1] AND Ribassista[2] THEN
IF close > max(HH[1],HH[2]) THEN
BUY 1 contract at Market
ENDIF
ENDIF
ELSIF Ribassista AND Not ShortOnMarket THEN
IF Rialzista[1] AND Rialzista[2] THEN
IF close < min(LL[1],LL[2]) THEN
SELLSHORT 1 contract at Market
ENDIF
ENDIF
ENDIF
//graphonprice max(HH[1],HH[2]) coloured(0,0,255,255) AS "Massimo"
//graphonprice min(LL[1],LL[2]) coloured(255,0,0,255) AS "Minimo"