DEFPARAM CumulateOrders=False
var1=3
var2=10
indicator1 = close
indicator2 = SuperTrend[var1,var2]
c1 = (indicator1 CROSSES OVER indicator2)
indicatorBB = BollingerUp[20](close) //BB UP
IF NOT LONGONMARKET and (c1 and ((high) < indicatorBB[0])) THEN
BUY 1 SHARES AT MARKET
ENDIF
// Condizioni per uscire da posizioni long
// 1) Candela con High e Low completamente out BB+
cond1=0
IF (high[1] and low[1]) > indicatorBB[0] Then
cond1=1
ENDIF
// 2) Candela con metà range out BB+
cond2=0
aa = high[1] - low[1] //range
bb = high[1] - indicatorBB[1] //
IF (aa > (aa/2)) > indicatorBB[1] THEN
cond2=1
ENDIF
// 3) Candela rossa dopo condizione 2
cond3=0
rossa = (open[0] > close[0])
IF rossa and cond2 and (rossa < indicatorBB) THEN
cond3=1
ENDIF
// 4) Exit Cambio colore da Long a Short
c2 = (indicator1 CROSSES UNDER indicator2)
IF LONGONMARKET and cond1 or cond2 or c2 THEN
SELL AT MARKET
ENDIF