BarOffset and DST

Posted By: MegaTanker

BarOffset and DST - 04/18/22 20:03

Greetings. I look into deploying a strategy that evaluates daily bars of US equities once per day. The default BarOffset of 940 would then sample the bars at 15:40 UTC, which if I am not mistaken would occur 10 minutes after open in winter months. But during summer months with DST, the market opens at 14:30 UTC. Does that mean Zorro would still sample at 15:40 UTC, so 70 minutes after open? Can I correct for this in the script by setting BarOffset depending on what dst() returns or is this variable read only once the session has started?
Posted By: Zheka

Re: BarOffset and DST - 04/18/22 23:37

BarZone=ET;
BarOffset=16*60;
BarPeriod=1440;
Posted By: MegaTanker

Re: BarOffset and DST - 04/19/22 08:08

BarZone looks like what I need but it doesn't seem to be doing anything. The timestamps of the bars in the chart remain unchanged and when I try triggering something with the hour() function, it still uses the default timezone. Tried various settings, EST, CET and just integers
Posted By: Zheka

Re: BarOffset and DST - 04/19/22 08:21

Look in the log for timestamps, not chart (of daily? bars). If you indeed use daily bars, how/why would you "trigger something" based on hour()? Look in the manual for hour() (and 1 line beneath).
Posted By: MegaTanker

Re: BarOffset and DST - 04/19/22 08:48

I used hour bars just to test how BarZone behaves, to better understand it. Even the logfile still has the first bar at 15:00 with BarZone set to EST, same as with BarZone set to UTC.

Perusing the manual, I found a line in the release history, which says "The BarZone variable can be used to shift daily bars to a certain local time zone." So I guess this feature is designed only for daily bars. Then it makes sense that hourly bars don't work.
Posted By: Petra

Re: BarOffset and DST - 04/19/22 10:11

https://zorro-project.com/manual/en/log.htm

BarZone is for all bars. But of course you would see no different bar timestamps in the log when you use 1H bars.
© 2024 lite-C Forums