Correcting GMT Time in Strategy Tester Backtests
Summary
The document explains why MetaTrader’s TimeGMT function can give misleading results in the strategy tester: there, it matches simulated trade-server time. It describes a library that estimates the broker’s GMT offset from historical hourly bars and subtracts that offset from server time to produce an estimated GMT value. Recalculating the offset periodically is intended to capture broker daylight-saving changes.
The guide outlines including the library in an expert advisor and describes an option to estimate the offset using gold or the chart symbol. A sample tester log illustrates a change in the reported offset, while the discussion explains how broker schedules and market opening times affect the estimate. The method depends on suitable quote history and the chosen symbol’s trading hours; the text notes gold’s session timing can shift detected transitions. The library changes tester behavior only, and accurate session conversion still requires accounting for the destination market’s daylight-saving time.
Key ideas
- In the strategy tester, TimeGMT may equal simulated server time rather than actual GMT.
- The library estimates a broker offset from hourly quote history and subtracts it from server time.
- The offset is recalculated periodically to account for changes in broker daylight-saving schedules.
- Gold is the default reference symbol, while the current chart symbol can be selected instead.
- Session-time conversions also depend on the destination market’s time zone and daylight-saving status.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.