Forum on trading, automated trading systems and testing trading strategies
MT5 Python API Timestamp Discrepancy on MetaQuotes-Demo — Build 6259
Sergey Golubev, 2026.10.14 09:02
It was already discussed many times, for example:Can MQL5 uniquely determine the UTC open time of historical CopyRates bars?
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.You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Title: MT5 Python API timestamp discrepancy: UTC vs server time (Build 6230)
Hello,
I am investigating a timestamp discrepancy in the MetaTrader 5 Python integration and would appreciate technical guidance on the expected timestamp behavior.
Environment
Operating system: Windows
Python package: MetaTrader5 5.0.6231
MT5 terminal build: 6230 (25 Sep 2026)
Broker: LiteFinance
Server: LiteFinance-MT5-Demo
Symbol: XAUUSD_o
Windows system clock: synchronized to UTC; local timezone UTC+03:30
Broker-confirmed server time on October 28, 2026: GMT+2
Observed behavior
On October 28, 2026, at approximately 08:33 UTC, I observed the following:
datetime.now(timezone.utc) returned approximately 08:33 UTC.
mt5.symbol_info_tick("XAUUSD_o") returned a time_msc value that, when interpreted as a Unix timestamp in UTC, corresponded to approximately 10:33 UTC.
mt5.copy_rates_from_pos() returned recent M1 candles timestamped around 10:33 UTC.
mt5.copy_rates_range(), when called with UTC-aware Python datetime arguments around 10:33 UTC, returned candles matching those from copy_rates_from_pos().
mt5.copy_rates_range(), when called for the period around 08:33 UTC, returned different candles with different prices.
mt5.copy_ticks_from() and mt5.copy_ticks_range(), using UTC-aware datetime arguments around 08:33 UTC, returned historical ticks timestamped around the requested time.
For example, a candle returned by copy_rates_from_pos() at 10:32 UTC had a close price of approximately 4049.96, while the candle returned by copy_rates_range() at 08:33 UTC had a close price of approximately 4030.44.
The results suggest that the timestamp handling or time interpretation may differ between these API functions.
The broker has confirmed its server timezone schedule but has referred me to MetaQuotes for clarification of the Python API behavior.
Questions
Are the time and time_msc fields returned by symbol_info_tick() always Unix timestamps representing UTC?
Are timestamps returned by copy_rates_from_pos(), copy_rates_range(), copy_ticks_from(), and copy_ticks_range() guaranteed to use the same UTC time basis?
Should all datetime arguments passed to these history functions be explicitly expressed in UTC, regardless of the broker's server timezone?
Is this behavior known in MT5 terminal build 6230 or Python package version 5.0.6231?
Is there a recommended diagnostic procedure or known workaround to ensure consistent UTC timestamps across live ticks, historical ticks, and candle data?
I have not applied any timestamp correction to my application because I want to establish the correct behavior before modifying the code.
Thank you for your time and assistance.
Best regards