Forum on trading, automated trading systems and testing trading strategies
MetaTrader5 Python API timestamp semantics: UTC or broker server time?
Sergey Golubev, 2026.09.30 08:50
It was already discussed many times, for example:
Ask your AI to search for answers before posting.
Forum on trading, automated trading systems and testing trading strategies
MetaTrader 5 build 6231: clock basis of historical Symbols → Ticks timestamps and exported CSV
Alain Verleyen, 2026.10.08 16:00
ALL data MT5 returns are ALWAYS broker server time data.Thank you very much, Sergey and Alain, for taking the time to respond.
Sergey, I appreciate you sharing the related discussions and references. I will read through them carefully.
Alain, thank you for clarifying that MT5 returns broker server time data. This is very helpful for understanding the timestamp behavior.
I sincerely appreciate both of your help and guidance.
Best regards.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Subject: Can MQL5 uniquely determine the UTC open time of historical CopyRates bars?
I would like to clarify the technical guarantees of MetaTrader 5 regarding historical bar timestamps.
This is a question about MQL5 API behavior, not trading strategy or a specific broker's DST policy.
Suppose a broker uses UTC+2 in winter and UTC+3 in summer.
Does MqlRates.time, returned by CopyRates(), represent the broker's server-time bar opening label, or is it guaranteed to represent an absolute UTC instant?
Is there any official MQL5 API or historical metadata that provides the broker's UTC offset applicable when a particular historical bar opened?
If the broker's server clock moves backward at the end of DST and bars exist during the repeated hour, how does MT5 represent and distinguish those bars?
After a terminal restart or historical data download, can the UTC opening time of each historical bar be uniquely reconstructed using only standard MQL5 APIs?
Are these behaviors documented or guaranteed by MetaQuotes? If so, could you provide the relevant official documentation?
I understand that DST transitions often occur while the Forex market is closed. However, I am specifically asking about the guarantees of the platform and its historical timestamp representation, rather than assuming that no bars exist during a transition.
References:
https://www.mql5.com/en/docs/series/copyrates
https://www.mql5.com/en/docs/constants/structures/mqlrates
https://www.mql5.com/en/docs/dateandtime
Thank you for any technical clarification or authoritative references.