Skip to content
All library documents

Diagnosing Frozen and Backward Server Time in Trading Platforms

Article MQL5 code base

Summary

This diagnostic note explains how a trading platform’s server clock, TimeCurrent(), can behave differently from the computer’s local clock, TimeLocal(). The server time may stop advancing when no market tick arrives, or move backward after events such as changing symbols, reconnecting, or receiving a tick from another instrument. The proposed check samples both clocks repeatedly during a fixed observation window and reports their readings, starting offset, elapsed advance, longest freeze, and count of backward steps.

The note recommends local time for timestamps, calendar dates, day transitions, and expiry calculations, while reserving server time for market-session hours and comparing with market data. Its evidence is diagnostic output from the observation window, not a broad reliability study. Results depend on when the check runs: during an active market with incoming ticks, a short run may show no issue, while a closed market makes a freeze easier to observe. The advice is specific to this platform’s clock behavior and does not establish that local time is accurate or synchronized.

Key ideas

  • The server clock can freeze when ticks stop arriving and can step backward after certain platform events.
  • A repeated comparison with local time can reveal freezes, backward steps, offsets, and clock advancement.
  • The note recommends local time for calendar and expiry tasks and server time for sessions and market-data comparisons.
  • A short observation window only describes conditions during that run, so an active market may conceal the freeze behavior.
  • The diagnostic does not assess whether the local clock is accurate or synchronized.

Tags

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