EA trading at the wrong hour? Server time
EA Trade TesterDemo labHow we testFor AI agents
Your EA opens trades at 08:00. On your broker that was the London open. On another broker, or after the clocks change, the same 08:00 can be an hour or more away from it, and the EA trades a different market. This is one of the commonest hidden faults we see, and a backtest on one broker cannot show it.
What is broker server time?
MT4 and MT5 show prices in the broker's server time, not yours. Many brokers use New York + 7 hours, so the trading day rolls over at 00:00 server time, which is 17:00 in New York. In UK terms that is usually UK + 2 hours, and UK + 3 hours in the weeks when only the US has moved its clocks (in 2026: 8 to 28 March and 25 October to 1 November). Other brokers use GMT, GMT+2 fixed, or other offsets.
How does it break an EA?
| Code | What happens |
|---|---|
input int StartHour = 8; and the server clock | 8 means 06:00 UK on a New York + 7 broker and 08:00 UK on a GMT broker: two different sessions |
TimeLocal() | uses the clock of the computer running MT5; on a VPS in another country it changes again |
TimeGMT() in the Strategy Tester | derived from the server time in the tester, so a GMT-based rule can be wrong in backtests |
| Mixed clocks | hours compared across clocks shift with the broker's time zone and daylight saving |
How do we test for it?
The first read flags fixed session hours with no GMT offset or daylight-saving handling, and every TimeLocal() / TimeGMT() use. In the lab, the clock sweep runs the rules with the clock moved from -3 to +3 hours. If the result only works at one exact clock, the edge may be an accident of one broker's time zone. The clock sweep is shown for information: it does not fail a test by itself.
How do I make an EA clock-safe?
- Give it an input for the broker's GMT offset, and handle summer and winter time, or
- work from the server clock only, and write down which broker clock the settings were made for.
- Never use the computer's local clock for trading hours.
Related pages
- MQL5 / MQL4 EA code checker
- EA costs: spread, commission and swap
- Free forex EA tester online
- How we test
- EA Trade Tester home: test your EA, bot, indicator or report
Questions people ask
Why does my EA work in the tester but trade at odd hours live?
Often a clock: the tester uses the server time of its history, while TimeLocal() or a VPS clock is different live.
What time zone are your tests in?
Our prices are on FxPro server time (New York + 7 hours), the same for every period.
Does the clock sweep fail my EA?
No. It is shown for information; it tells you how much the result depends on the exact clock.
Is this financial advice?
No. It is about how code reads time. Not financial advice.