Loading…

Server Time Drift Monitor

Session filters, news filters and rollover logic are almost always written against an assumed server-to-GMT offset. That offset is not fixed - it changes twice a year for brokers that observe daylight saving, and it can change without warning if a broker migrates servers or timezones. Nothing in the terminal tells you when this happens; a filter just quietly starts firing an hour early or late. This monitor compares TimeCurrent() (server), TimeLocal() (the PC clock) and TimeGMT() on a timer, shows both offsets on the chart, and alerts the moment the server-to-GMT offset shifts by more than a configured number of minutes between checks. It also tracks how long server time itself has gone without advancing, since a market gone quiet makes TimeCurrent() look frozen for a completely different, unrelated reason - that condition is reported separately so it is never mistaken for a genuine offset change. Notes and limitations - TimeGMT() is computed from the terminal's own timezone configuration, not independently verified against an external time source - it is as reliable as the PC's regional settings. - A stale-server alert can also fire during genuinely thin liquidity (very early Monday, deep holiday sessions) where ticks are simply rare rather than the feed being broken. - Read-only. It never sends, modifies or closes an order - only Alert and Comment are used to surface what it finds.

Expert advisor · MT5 · v1.0 · Free

About Server Time Drift Monitor

Server Time Drift Monitor is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 3 settings, such as Check interval secs, Drift alert minutes and Stale server minutes. MQL source code included.

Files in the download: ServerTimeDriftMonitor.ex5, ServerTimeDriftMonitor.mq5, ServerTimeDriftMonitor.txt.

Settings

SettingDefaultWhat it does
Check interval secs60How often to compare server, local and GMT time
Drift alert minutes10Alert when the server-versus-GMT offset shifts by at least this many minutes between checks
Stale server minutes15Alert when server time has not advanced for this many minutes (feed likely stalled)

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: Alerts · Trading Sessions · News Trading · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria