This is my current code and in order to optimize it, I need to eliminate the amount of orders the system opens during chop times. However I seem unable to code this. This means that from the time we are stopped out until the next order is placed in the system. Thank you for your help!
I can’t get it to work with the suggested code.
BarIndex-TradeIndex>1
If LongOnMarket and (BarIndex-TradeIndex)>1 and Close > TradePrice then
This is my current code!
//Conditions to enter long or short at Europe Open
DefParam CumulateOrders=False
DEFPARAM FLATBEFORE = 090000
DEFPARAM FLATAFTER = 110000
If OpenTime=085000 then
RangeHigh=High
RangeLow=Low
EndIf
If OpenTime=>085000 and OpenTime<090000 then
RangeHigh=max(RangeHigh,High)//Highest of Range
RangeLow=min(RangeLow,Low)//Lowest of Range
EndIf
If OpenTime=>085500 then
Buy 1 contract at RangeHigh+3*pipsize Stop
SellShort 1 contract at RangeLow-3*pipsize Stop
EndIf
//Set Stop Loss
IF LongOnMarket THEN
SET STOP LOSS RangeLow
ENDIF
IF ShortOnMarket THEN
SET STOP LOSS RangeHigh
ENDIF
GraphOnPrice RangeHigh as “RangeHigh”
GraphOnPrice RangeLow as “RangeLow”