Skip to content
All library documents

Converting Bar and Tick Times Between Broker Time Zones

Article MQL5 code base

Summary

This programming note describes a function for converting timestamps stored by one broker into another broker's server time zone. It is intended for timestamps associated with bars, ticks, or economic calendar events. The function takes a source time, standard UTC offsets for both servers, and daylight-saving rules for each location, allowing the conversion to account for US, European, or absent daylight-saving schedules.

The note emphasizes the sign convention: positive offsets represent zones east of UTC, which is opposite to the sign used by MQL5's built-in UTC-offset function. It points readers to separate resources for identifying daylight-saving schedules and for a more extensive time-zone library. The excerpt provides only the function interface and a qualitative description; it does not include the implementation, worked conversion examples, tests, or discussion of ambiguous local times around daylight-saving transitions. Correct schedule selection and offset inputs remain necessary for reliable timestamp alignment.

Key ideas

  • The function converts stored broker timestamps using source and destination UTC offsets.
  • Separate daylight-saving rules can be supplied for both server locations.
  • Its offset signs follow common programming conventions and oppose MQL5's built-in convention.
  • The excerpt does not include implementation details or worked examples.
  • Accurate conversion depends on correct offsets and daylight-saving schedules.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.