defparam CumulateOrders = False
defparam preloadbars = 350
defparam flatbefore = 000000
defparam flatafter = 100000
//parameters
rate = 37000/300
capital = rate*1000 //in euro
margin = rate*300 //in euro per point
maxdailyloss = capital*0.01
maxdailyprofit = capital*0.01
positionsize = capital/margin
//money management
once tradeallowed=1
if intradaybarindex=0 then
myprofit=strategyprofit
tradeallowed=1
endif
if StrategyProfit >= myprofit + maxdailyprofit or strategyprofit <= myprofit-maxdailyloss then
tradeallowed=0
endif
//pending order management
if time=010000 then
buylevel = highest[15](high)
selllevel = lowest[15](low)
minimum = buylevel-selllevel
endif
distance = (buylevel-selllevel)*0.5
//long pending order
if time>=010000 and time<100000 and close>(buylevel-distance) and tradeallowed=1 and not shortonmarket then
buy positionsize contracts at buylevel stop
sl = 50
set target $profit capital*0.02
set stop ploss min(minimum,sl)
endif
//short pending order
if time>=010000 and time<100000 and close<(selllevel+distance) and tradeallowed=1 and not longonmarket then
sellshort positionsize contracts at selllevel stop
sl = 50
set target pprofit 10
set stop ploss min(minimum,sl)
endif