// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
maxdailyprofit=20000
maxdailyloss=2
once tradeallowed=1
if intradaybarindex=0 then
myprofit=strategyprofit
tradeallowed=1
endif
if strategyprofit>=myprofit+maxdailyprofit or strategyprofit<=myprofit-maxdailyloss then
TradeAllowed=0
endif
// Prevents the system from creating new orders to enter the market or increase position size before the specified time
noEntryBeforeTime = 153000
timeEnterBefore = time >= noEntryBeforeTime
// Prevents the system from placing new orders to enter the market or increase position size after the specified time
noEntryAfterTime = 220000
timeEnterAfter = time < noEntryAfterTime
// Conditions to enter long positions
indicator1 = RSI[2](close)
indicator2 = RSI[2](close)+15
c1 = (indicator1 >= indicator2[1])
c2 = (indicator1 > 60)
IF tradeallowed=1 and c1 and c2 and timeenterbefore and timeenterafter THEN
BUY 0.2 CONTRACT AT MARKET
ENDIF
// Conditions to enter short positions
indicator3 = RSI[2](close)
indicator4 = RSI[2](close)-15
c3 = (indicator3 <= indicator4[1])
c4 = (indicator3 < 40)
IF tradeallowed=1 and c3 and c4 and timeenterbefore and timeenterafter THEN
SELLSHORT 0.2 CONTRACT AT MARKET
ENDIF
SET STOP TRAILING 6