I spent sometime experimenting and this is what I figured how it works. I may not be 100% correct, but this might help
Say, the data (historical or from broker) is in UTC. In your script, you want to use local times and align the bars with the local time zone. However, assets can be of different classes, on different exchanges in different time zones and have different trading hours. Zorro offers a couple of ways to handle this (as you might have a mix of assets with different local times and trding hours). Also, you could be isitting in a whole different time zone, and you want everything referenced to your time zone (local time zone)..
Set BarZone to the local time zone. Generated bars will alsign with the local times, i.e. start and end of day. BarZone becomes your reference. I am in EST, but I could be trading assets in WET, CET, etc. When I set BarZone=EST, all bars are adjusted to EST.
To specify the time zone and market hours for each asset, either:
- set that in your script using AssetMarketStart/AssetMarketEnd/AssetMarketZone, or
- set that in assetList file using zzz:hh:mm-hh:mm (for Market field). In this case, AssetMarketStart/AssetMarketEnd/AssetMArketZone will be set to what is in the assetList file. However, you can override them again in your script if you need too.
So you can jsut set time zones and market hours in assetList, and not worry about AssetMarketStart/End/Zone, unless you need to override that in your script for whatever reason.
The next thing is how and when to generate the bars, i.e. daily sessions (i.e. market hours), weekends, etc. This is determined by BarMode (among other things). For example, to generate bars during market hours only (i.e. 10:30-15:00) and no weekends, you set BarMode = BR_MARKET | BR_WEEKENDS. If you want bars 24hour a day but no weekends, BarMode = BR_FLAT | BR_WEEKEND, and bars for 24/7 BarMode = BR_FLAT, etc.
The weekend is determined by StartWeek and EndWeek, whihc you can leave to default or change in the script.
BR_LCOAL is special (to me anyways
as it sets Start/EndMarket to the local asset time zone and market hours, read from AssetMarketStart/End/Zone (and converted to your time zone ref, i.e. BarZone), and of course AssetMarketStart/End/Zone is either set in the script directly or read from assetList, as mentioned above.
As an example, I was interested in intraday 1min data for the SP500 future, which trades around the clock with daily session 09:30-17:00 EST. My 1-min historical data is in UTC, and I am in EST, and I am interrested in day seesion only. So, my doe is
BarPeriod = 1;
StartDate = 20221201;
EndDate = 20221205; // short range for verification
BarZone = EST;
BarMode = BR_LOCAL | BR_WEEKEND | BR_MARKET;
and in the assetList, I have EST:09:30-17:00. WeekStart/End defaults are just fine. This will generate bars Mon-Fri, from 09:30 to 16:59 EST. BEcause I have BR_LOCAL flag set, Start/EndMarket will automatically be updated to the market hours from AssetMarketStart/End/Zone, which in turn are read from assetList (and I do not need to change them in the script).
I hope this helps. It is very flexible and powerful and allows you to deal with many scenarios. With flexibility comes some complexity though.
Again, I may not be a 100% correct, but that is what I figured. I would love to hear any corrections/additions, as understanding this (and actually verifying it) is critical if you do intraday trading that explores time-of-day price behaviour.