DEFPARAM CumulateOrders = false // Cumulating positions deactivated
// The system will cancel all pending orders and close all positions at 0:00. No new ones will be allowed until after the "FLATBEFORE" time.
DEFPARAM FLATBEFORE = 060000
// Cancel all pending orders and close all positions at the "FLATAFTER" time
DEFPARAM FLATAFTER = 130000
CountBuy = 0
EMA25 = exponentialaverage[25]
if currenttime = 080000 then
max1 = high
min1 = low
endif
if currenttime = 070000 then
max2 = high
min2 = low
endif
if currenttime = 060000 then
max3 = high
min3 = low
endif
Maximum = max(max1,max(max2,max3))
Minimum = min(min1,min(min2,min3))
if currenttime = 090000 then
EMA25Price = exponentialaverage[25]
endif
RangeSize = Maximum - Minimum
if Maximum > EMA25Price and Minimum > EMA25Price and CountBuy = 0 then
if time = 080000 and CountBuy = 0 and high < Maximum then
BUY 1 CONTRACTS AT Maximum stop
SET STOP LOSS RangeSize
SET TARGET PROFIT RangeSize
BUY 1 CONTRACTS AT Maximum stop
SET STOP LOSS RangeSize * 2
SET TARGET PROFIT RangeSize
CountBuy = 1
endif
if currenttime = 090000 and CountBuy = 0 and high < Maximum then
BUY 2 CONTRACTS AT Maximum stop
SET STOP LOSS RangeSize
sell 1 contracts at Maximum + RangeSize limit
sell 1 contracts at Maximum + 2*RangeSize limit
//SET TARGET PROFIT RangeSize
CountBuy = 1
endif
if currenttime = 100000 and CountBuy = 0 and high < Maximum then
BUY 1 CONTRACTS AT Maximum stop
SET STOP LOSS RangeSize
SET TARGET PROFIT RangeSize
CountBuy = 1
endif
if currenttime = 110000 and CountBuy = 0 and high < Maximum then
BUY 1 CONTRACTS AT Maximum stop
SET STOP LOSS RangeSize
SET TARGET PROFIT RangeSize
CountBuy = 1
endif
endif
//graph CountBuy
graph Maximum