Time zone handling

Zorro's standard time zone is UTC (Greenwich mean time), which is also the time zone of historical data, logs, and charts. Time and date functions and variables are normally also based on UTC time. Alternatively, local time zones can be used either on the bar or on the asset level. For handling or converting time zones, the following variables are available:

BarZone

Time zone of bars (default: UTC). Affects bar generation: daily bars will start and end at BarZone midnight plus BarOffset. For this, set BarZone before the first asset call. BarZone is also used by several date/time functions that use local time. For using specific asset-dependent time zones with intraday bars, see AssetFrameZone and AssetMarketZone

HistoryZone

Time zone of the historical data files, for converting them to UTC. This variable is rarely needed since timestamps in historical data files should be already in UTC. If not, set HistoryZone to the time zone in the data. The time stamps in historical data files and dataset files are then automatically converted to UTC on dataLoad or dataParse.

BrokerZone

Time zone of the broker plugin. This variable is rarely needed since broker plugins normally return timestamps in UTC. Otherwise the broker plugin is supposed to set BrokerZone with the GET_BROKERZONE command. The broker API time stamps are then converted to UTC on import.

LogZone

Time zone of the log and chart. If not set, all dates and times in the log and chart are in UTC.
  

AssetMarketZone

Time zone of the current asset; initally read from the Market field of the asset list, otherwise copied from BarZone or set by script.

AssetFrameZone

Time zone of the current asset for daily trading; used to set AssetFrame to a daily TimeFrame that begins at FrameOffset in local time. 

Type:

int, UTC for UTC time (default), EST for New York, WET for London, CET for Frankfurt, AEST for Sydney, JST for Tokyo, or any number from -23..+23 that gives the time zone offset in hours to UTC. Daylight saving time is used, except for UTC and for time zones at or beyond JST.
 

AssetFrame

Asset specific time frame, automatically set by AssetFrameZone. 0 when the current asset had no price quotes in the current bar or when its market is closed; negative number of skipped bars when the market opens; 1 otherwise. Normally used to set TimeFrame = AssetFrame for skipping bars outside market hours, or for trading on different time zones (see example). 

Type:

int, read/only
 

Remarks:

Examples:

// trade daily at 15:30 New York time
BarPeriod = 1440;
BarOffset = 15*60+30;
BarZone = EST;
...

// trade two assets on different time zones
BarPeriod = 60;
FrameOffset = 10; // trade both assets at 10:00 am local time
while(asset(loop("EUR/USD","USD/JPY")))
{
  if(strstr(Asset,"EUR"))
    AssetFrameZone = WET;
  else if(strstr(Asset,"JPY"))
    AssetFrameZone = JST;
  TimeFrame = AssetFrame; // use a daily time frame changing at 10:00 local time
  ...
}

See also:

TimeFrame, StartMarket, BarMode, Time/Date functions,. asset

 

► latest version online