//definizione dei parametri del codice
DEFPARAM CumulateOrders = false // posizioni cumulate disattivate
//il sistema cancellerà tutti gli ordini in attesa e chiuderà tutte le posizioni a 0:00. dopo l'orario "flatbefore" non saranno piazzati nuovi ordini o posizioni.
DEFPARAM FLATBEFORE = 153300
// Cancellare tutti gli ordini in attesa e chiudere tutte le posizioni all'orario "Flat After"
DEFPARAM FLATAFTER = 180000
once Cond = 0
IF OnMarket or close < ema13 THEN
Cond = 0
c5 = 0
ENDIF
ema13 = average[13,1](close)
// Impedisce al sistema di tradare in giorni specifici della settimana
daysForbiddenEntry = OpenDayOfWeek = 6 OR OpenDayOfWeek = 0
OTD = (Barindex - TradeIndex(1) > IntradayBarIndex)
// Condizioni per entrare su posizioni long
indicator1, ignored, ignored, ignored, ignored, ignored, ignored = CALL "PRC_VWAP intraday"
indicator2 = SuperTrend[4,52]
c1 = (indicator1 CROSSES OVER indicator2)
indicator3 = SuperTrend[4,52]
c2 = (close > indicator3)
c4 = high > high[1]
IF c1[1] and c2[1] and c4 then
Cond = 1
endif
if Cond = 1 THEN
c5 = (low <= ema13) and (close > ema13) and (close[1] > ema13[1]) and (open[1] > ema13[1])
if c5 then
Entrata = ema13
Cond = 0
endif
endif
IF c5 AND not daysForbiddenEntry and OTD and Not OnMarket THEN
BUY 10000 CASH AT Entrata LIMIT
ENDIF
// Condizioni per uscire da posizioni long
indicator4 = SuperTrend[4,52]
c3 = (close CROSSES UNDER indicator4)
IF c3 and OnMarket THEN
SELL AT MARKET
Cond = 0
ENDIF
// Stop e target: Inserisci qui i tuoi stop di protezione e profit target
SET STOP %LOSS 1
//graph Cond coloured(255,0,0,255)
//graph c5