DEFPARAM CUMULATEORDERS =false
DEFPARAM flatbefore=070000
DEFPARAM flatafter=210000
timeframe (1h,default)
ciclo= Cycle(close)
//condizionelong
Long= ciclo>1
//condizioneshort
Short= ciclo<1
//condizionelong
medieLong=Average[7](close)<ExponentialAverage[3](close)
//condizioneShort
medieShort=Average[7](close)>ExponentialAverage[3](close)
once trade=0
if long then
trade=1
endif
if short then
trade=-1
endif
if trade=1 and medielong then
trade=2
endif
if trade=-1 and medieshort then
trade=-2
endif
timeframe (default) // timeframe entry 5 o 3 min
mymediah15, mydefault = CALL "hull multi"
//media HULL 5 min
Verde5 = mydefault > mydefault[1]
Rosso5 = mydefault < mydefault[1]
Cambio5 = (Verde5 AND Rosso5[1]) OR (Verde5[1] AND Rosso5)
//media HULL 15 min
Verde15 = mymediah15 > mymediah15[1]
Rosso15 = mymediah15 < mymediah15[1]
Cambio15 = (Verde15 AND Rosso15[1]) OR (Verde15[1] AND Rosso15)
HullLong= verde5 and verde15
HullShort= rosso5 and rosso15
//entrylong
EL= close CROSSES OVER Supertrend[3.5,10]
//entryshort
ES= close CROSSES UNDER Supertrend[3.5,10]
IF trade=1 and HullLong then
if EL then
Buy 0.5 contract at market
endif
endif
IF trade=2 and HullLong then
if EL then
Buy 0.6 contract at market
endif
endif
IF trade=-1 and HullShort then
if ES then
SELLSHort 0.5 contract at market
endif
endif
IF trade=-2 and HullShort then
if ES then
SELLSHort 0.6 contract at market
endif
endif
if close CROSSES UNDER Supertrend[3.5,10] then
sell at market
endif
if close crosses over Supertrend[3.5,10] then
exitshort at market
endif