//-------------------------------------------------------------------------
// Hauptcode : supertrend dax m2 lt 1/10 sl0
//-------------------------------------------------------------------------
DEFPARAM CumulateOrders = false
DEFPARAM PreLoadBars    = 2000
 
 
tradeok=0
t1 = time < 173000
t2 = time > 090000
if t1 and t2 then
tradeok=1
endif
 
ONCE nLots              = 1                   //Numero di lotti da acquistare/vendere
ONCE Minimo             = 0                   //Minimo  della candela dove è avvenuto l'incrocio
ONCE Massimo            = 999999              //Massimo della candela dove è avvenuto l'incrocio
ONCE MaxPips            = 0                   //Numero di Pips oltre Minimo/Massimo per entrare in rottura
ONCE ExitPips           = 10                  //Numero di Pips oltre Minimo/Massimo per uscire dalle posizioni
//
 
 
IF IntraDayBarIndex = 0 THEN                 //Ad inizio nuovo giorno resettare le variabili
Minimo               = 0
Massimo              = 999999
ENDIF
 
St                      = SuperTrend[1,10]    //1, 10
 
IF close CROSSES OVER St THEN
Minimo               = 0
Massimo              = high
ENDIF
 
IF close CROSSES UNDER St THEN
Minimo               = low
Massimo              = 999999
ENDIF
 
IF tradeok=1 and LongOnMarket THEN                         //Chiudere l'operazione LONG se il prezzo rompe il minimo
SELL                      AT (Minimo - (ExitPips * pipsize)) STOP   //Uscire    LONG
SELLSHORT nLots CONTRACTS AT (Minimo - (ExitPips * pipsize)) STOP   //Rientrare SHORT
ENDIF
 
IF tradeok=1 and ShortOnMarket THEN                        //Chiudere l'operazione SHORT se il prezzo rompe il massimo
EXITSHORT                 AT (Massimo + (ExitPips * pipsize)) STOP  //Uscire SHORT
BUY nLots CONTRACTS       AT (Massimo + (ExitPips * pipsize)) STOP  //Rientrare LONG
ENDIF
 
IF NOT OnMarket THEN
IF tradeok=1 and Massimo < 999999 THEN
BUY        nLots CONTRACTS AT Massimo + (MaxPips * pipsize) STOP //Comprate n Pips oltre il Massimo
ENDIF
IF tradeok=1 and Minimo > 0 THEN
SELLSHORT  nLots CONTRACTS AT Minimo  - (MaxPips * pipsize) STOP //Vendere  n Pips sotto il Minimo
ENDIF
ENDIF
 
set stop ploss 90