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
time. For using market hours, time stamps, or time frames in a local time zone, the following variables
Time zone of bars (default: UTC). Affects the bar start and end
time, similar to BarOffset. Daily bars will start and end
at BarZone midnight plus BarOffset. For
using asset-dependent time zones, see AssetZone and AssetMarket.
Time zone of the historical data files (default: UTC). Normally, timestamps in historical data files
should be in UTC; otherwise set this variable to their time zone. The time stamps
in historical data files and dataset files are
then automatically converted to UTC on file loading or parsing.
Time zone of the broker plugin. Normally, broker plugins should return
timestamps in UTC; if not, this variable is automatically set to the used time zone
by the GET_BROKERZONE command. The time
then converted to UTC on import.
Time zone of the current asset, used for setting AssetFrame to a daily
TimeFrame that begins at FrameOffset in local time. When your strategy contains a portfolio of different assets that you want to trade
daily at different times, use this parameter to define the time frames of individual assets.
Time zone of the current asset, used for setting AssetFrame to a non-daily TimeFrame that skips all bars outside market hours in local time, but follows the BarPeriod inside market hours.
Market hours are determined by StartMarket and EndMarket
in the AssetMarket time zone. AssetMarket is mutually exclusive to AssetZone,
and is used for intraday trading.
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..+24 that gives the time zone
offset in hours to UTC. Daylight saving time is used except for UTC and JST.
Asset specific time frame, automatically set by AssetZone or AssetMarket.
0 when the current asset had no price quotes
in the current bar or when its market is closed; the 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).
- BarZone, HistoryZone, and BrokerZone affect the sampling of
bars and thus must not be changed anymore after selecting the asset.
AssetZone and AssetMarket must be set after selecting the asset
and can be changed at runtime.
- If backtests use price history in local time, all time/date functions
and variables are in local time instead of UTC. Special time zone handling
is then not needed.
- Setting a non-UTC BarZone can cause a daily bar of 23
or 25 hours when the daylight saving period begins or ends. The
run function can run twice or be skipped when the
clock is set backwards or forwards. This should be
taken into account in strategies that strongly rely on a 24-hour bar period or
on bars ending or starting at a certain time.
- StartWeek and EndWeek are
always in UTC and must be adapted to BarZone if necessary.
- For emulating day bars of different assets with different time zones, use 1-hour bars with AssetZone and AssetFrame (see example). Use FrameOffset for starting the emulated bar at a certain local hour.
- For skipping bars outside market hours, set AssetMarket
to the time zone and set TimeFrame =
AssetFrame. For only preventing trades outside market hours without
skipping bars, set the BR_LEISURE flag or check the trade time by script.
// trade two assets with different time zones
BarPeriod = 60;
FrameOffset = 9; // trade both assets at 9:00 of their local time
AssetZone = WET;
AssetZone = JST;
TimeFrame = AssetFrame; // use a daily time frame changing at 9:00 local time
TimeFrame, StartMarket, LookBack, asset
► latest version online