I have faced the same problem. I am creating a strategy backtest to use in diferent instrements from diferent time zones. to simplify this I am going to speak about ES and FDAX with UTC-6 and UTC+1. This strategy uses open session time and close session time as reference.
The problem is how to manage time(hour),as example I show a code to cancel orders no filled 1 hour before close market but the time manage by strategy is local time, as my local time is UTC+1 I have no problem with FDAX but I found problems with ES due to saving time change is not done at same time in Europe and EEUU and during thse days my orders are canceled 1 hour before I want to do it. In the rest of time I only have to define the time base on my local time.
My questions is
Is there any way to use trading hours defined in the strategy as strategy/bars time for each strategy to avoid problems with saving change time? I cannot change by tools my time becuase I will use both strategies at same time and in this case one of them no wok properly. I mean i want to get the instrument time when I print Time[0].
In FADX strategy I would like to get this code:
if (ToTime(Time[0]) > 210000 &&
(Position.MarketPosition == MarketPosition.Flat) )
In ES strategy I would like to get this code, using 140000 as 1 hour previous market close while my local time is UTC+1
if (ToTime(Time[0]) > 140000 &&
(Position.MarketPosition == MarketPosition.Flat) )
Regards.
Comment