Broker Server Time in MT5: Why Your Gold EA Clock Is Not Your Clock

6 December 2026, 13:44
Muhammad Zain Asghar
0
25

A gold EA that should stop trading before the New York close, or pause around 15:30 for US news, only works if it reads the right clock. In MT5 the chart clock is the broker's server time, not your time in Karachi, Riyadh or Dubai. Getting this wrong is one of the most common reasons a time filter "does nothing" on a live account.

The three clocks an EA can read

MQL5 gives an Expert Advisor three different times. TimeCurrent() returns the server time of the last quote. TimeLocal() returns the clock of the computer or VPS running the terminal. TimeGMT() returns GMT, calculated from the local clock and its time zone settings.

Chart bars, the Market Watch clock and the broker's trading sessions all use server time. For that reason most gold EAs keep their hour filters in server time and let the user convert.

How to find your broker's offset

Open MetaEditor, create a script, and add one line to OnStart(): Print((TimeCurrent()-TimeGMT())/3600); Run it on an XAUUSD chart while the market is open. The Experts tab shows the server offset from GMT in hours. Run it on a weekday only, because TimeCurrent() stops moving at the weekend.

Many brokers use GMT+2 in winter and GMT+3 in summer, so that the daily candle closes at 17:00 New York time. With a GMT+2 server in winter, your local time is:

  • Pakistan (PKT, GMT+5): server time plus 3 hours
  • Saudi Arabia (AST, GMT+3): server time plus 1 hour
  • UAE (GST, GMT+4): server time plus 2 hours

Check your own broker before using these numbers, as some servers run on GMT or GMT+1 all year.

Daylight saving: the twice-a-year trap

Pakistan, Saudi Arabia and the UAE do not change their clocks, but most broker servers do. When the server moves from GMT+2 to GMT+3, every gap in the list above shrinks by one hour. A filter set in server time keeps working; a note you wrote in local time is now one hour wrong.

The United States and Europe also change clocks on different dates. For a few weeks in March and around late October, US news can arrive one hour earlier on the server clock than usual. Check news-pause settings during those weeks.

Time filters in the Strategy Tester

In the Strategy Tester, TimeLocal() and TimeGMT() both return the simulated server time. An EA that uses TimeGMT() for its hour filter will therefore test in server time but trade live in real GMT. The backtest and the live account then filter different hours. If you write or review an EA, keep the filter on TimeCurrent() or test with a manual offset input.

Quick checklist before going live

Print the server offset on your broker. Convert your planned hours into server time and write both down. Confirm which clock the EA's time inputs use. Put a reminder in March and October to recheck. If you run on a VPS, make sure the VPS clock is synced, because TimeGMT() depends on it.

For a session-by-session view of when gold usually moves most, see our guide to the best time to trade gold (XAUUSD).

Risk warning: trading gold on margin is high risk and you can lose some or all of your deposit. Past results do not guarantee future results. This is general information, not financial advice.