defparam cumulateorders = false
DEFPARAM FLATBEFORE = 100000 //UTC
DEFPARAM FLATAFTER = 155900 //UTC
noentrybeforetime=101300
noentryaftertime=160000
timeenterbefore=time>=noentrybeforetime
timeenterafter=time<noentryaftertime
IF time = 160000 THEN // UTC Time
EntryPrice = DClose(0)
ENDIF
N=2
Start=100000
If time=start then
Lrt=0
Srt=0
St=0
Lt=0
Endif
//Timeframe(1minutes,updateonclose)
up = PRTBandsUp
dn = PRTBandsDown
if close crosses over up and trend <= 0 then
trend = 1
elsif close crosses under dn and trend >= 0 then
trend = -1
endif
StartTrade=101300
If Time=startTrade then
OPN=open
endif
//OTD = (Barindex - TradeIndex(1) > IntradayBarIndex)
IF Trend=1 AND Lt<1 and OPN >entryprice and timeenterbefore and timeenterafter THEN//
BUY N CONTRACT AT MARKET
SL= lstp
TP=ltgt
Lt=Lt+1
ELSIF trend=-1 AND St<1 and OPN< entryprice and timeenterbefore and timeenterafter THEN//
SELLSHORT N CONTRACT AT MARKET
SL= sstp
TP=stgt
St=St+1
ENDIF
If longonmarket[1] and not onmarket and Strategyprofit[1]>strategyprofit and Lrt<1 and St<1 and trend=-1 then
sellshort 1*N contract at market
SL= Rlstp
TP=Rltgt
Lrt=Lrt+1
endif
If shortonmarket[1] and not onmarket and strategyprofit[1]>strategyprofit and Srt<1 and Lt<1 and trend=1 then
Buy 1*N contract at market
SL= Rsstp
TP=Rstgt
Srt=Srt+1
endif
set stop ploss SL
set Target Pprofit TP