Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Scripts

Server Clock Check - script for MetaTrader 5

Amul Ravikumar
Amul Ravikumar
  • Founder · MT5 / Full-stack Developer at  Brain Grain
  • India
  • 1032
5 (1)
MT5 / MQL5 developer. I build indicators, Expert Advisors and utility panels from a written spec — every rule an input, 0 errors / 0 warnings, verified in the Strategy Tester before handover.
Views:
109
Rating:
(1)
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

MetaTrader computes TimeTradeServer() and TimeLocal() from your computer's clock. If that clock drifts, every time-based rule in your EA drifts with it: pending orders with an expiry time expire early or late, session and news filters open and close at the wrong moment, and "close before the weekend" fires at the wrong second. The terminal shows no warning.


I hit this on a live VPS: the Windows time service had stopped, the clock was 11 seconds slow, and limit orders meant to live 15 seconds were expiring after 4.

This script measures the error directly. Each live tick carries the time the server stamped it with, to the millisecond. The script compares that stamp with your own clock at the moment the tick arrives, over 40 fresh ticks, and takes the smallest gap (a tick can never arrive before it was stamped), corrected by half the current ping.

Run it on an active symbol while the market is open. It prints to the Experts log and on the chart:
- OK, or WARNING with how many seconds your clock is AHEAD of or BEHIND the server
- smallest and median lag, ping, and the server's time zone
- on a warning, the Windows steps to fix it

Inputs: symbol (empty = chart symbol) · number of ticks · timeout · warning threshold in seconds.

It never opens, closes or modifies a trade. No DLLs.

Accuracy is about ±0.2 s, which is plenty to catch the multi-second drift that breaks order expiry. On a quiet symbol or a closed market it says so instead of guessing.

Multi-Indicator Divergence Detector Multi-Indicator Divergence Detector

Regular and hidden divergences between price and ten oscillators calculated inside the indicator: MACD, MACD histogram, RSI, Stochastic, CCI, Momentum, OBV, VWMACD, Chaikin Money Flow and MFI. Lines on price, a box naming every oscillator that agrees, and alerts.

Session Levels - Asian range, PDH/PDL, VWAP, swings and round numbers Session Levels - Asian range, PDH/PDL, VWAP, swings and round numbers

Session Levels draws the reference levels intraday traders watch most: Asian range, London and New York sessions, previous day and week high/low, daily VWAP, swing points and round numbers. Hover any level to read what it is and why it matters. Optional alerts when price breaks the Asian range or the previous day high/low.

Prop Daily Loss Meter Prop Daily Loss Meter

Shows how much of the daily loss limit of a prop firm account is already used, and how much is left. Read-only indicator.

Broker Clock Auditor Broker Clock Auditor

Reads the server clock from the symbol's own H1 history. The forex and CME week closes at 17:00 New York, so the server time of every weekly close gives the server's UTC offset for that week. Over 60 weeks it flags irregular closes, dates every clock change and tests it against the US and European daylight saving calendars, cross-checks TimeTradeServer minus TimeGMT, and lists the server time of the London, New York, Tokyo and Sydney opens for the coming weeks. Writes every close to CSV. Read only: no trade function, no DLL, no network.