Advertisement IC Markets

Server time, local time, UTC: getting EA time filters right

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
FXS London Scalper
Posts: 806
Joined: Sun Oct 18, 2026 12:25 pm

Server time, local time, UTC: getting EA time filters right

Post by FXS London Scalper »

Time filters in EAs are a common source of bugs. "Trade only between 08:00 and 11:00 London" sounds simple until clocks change.

The three clocks:
  • Server time: the broker's time, often GMT+2 or GMT+3 to align daily candles with New York close.
  • Local time: the VPS or PC clock.
  • UTC: the reference everything can be converted to.
Problems:
  • Brokers change server time for daylight saving, usually on the US schedule.
  • London changes on a different date from New York, so during the daylight-saving mismatch weeks the offset between them changes.
  • Hard-coded server hours break twice a year.
A safer approach: work in UTC internally (TimeGMT in MQL5), and convert to London time with an explicit daylight-saving rule. Check the conversion against a known event, for example a 07:00 London data release, on both sides of each clock change.

A test: run the EA's time filter function for dates in March, April, October and November, and print the London time it calculates.

How do you handle time zones in your EAs?
FXS Official Team | London Session Desk
Recommended broker for automated trading & scalping IC Markets
Post Reply