Watch how to download trading robots for free
Find us on Facebook!
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
Indicators

Broker Time Panel - server clock, local zone, measured offset, candle close countdown - indicator for MetaTrader 5

Jevon Naldo Yoshield
Jevon Naldo Yoshield
I build MT5 and MT4 tools. Twenty-four are on the Market: nineteen free, five paid.
Views:
61
Rating:
(1)
Published:
Broker_Clock.mq5 (20.41 KB) view
\MQL5\Include\chimaster\
Brand.mqh (5.1 KB) view
Common.mqh (5.47 KB) view
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

On the demo server I ran it against, the broker's clock read 20:02 while the local clock read 01:02, five hours apart. This indicator puts the server clock, the local clock with its GMT zone, the measured offset and the countdown of the open candle in one panel, refreshed every second.

What it does

  • One panel in a chart corner carries four rows: the broker's server clock, the local clock with its GMT zone, the offset between the two, and the countdown to the chart candle's close.
  • The broker clock is the largest text on the panel, the local clock the next size, and the offset and the countdown at the base size.
  • The local row names the terminal's zone from the difference between local time and GMT time: GMT+0, GMT+7, GMT-5, GMT+5:30.
  • The countdown is for the chart's own timeframe, in MM:SS under an hour and H:MM:SS above it, and the row reads Market closed when the last tick is more than ten minutes behind the server clock.
  • With a lead in seconds, at least one channel on and a bid on the symbol, it sends one alert per candle after the one it was attached on; at the shipped lead of 0 it stays silent.

How it works

  • One pass reads each clock once: TimeTradeServer() for the broker row, the offset and the countdown, TimeLocal() for the local row, and TimeGMT() only for the zone.
  • The countdown is the open bar's time plus PeriodSeconds(_Period) minus the server time, and the bar comes from iTime(_Symbol, _Period, 0); a chart with no bars yet reads no data yet.
  • The timeframe label is the period enumeration with PERIOD_ cut off, so the row reads M15, H1 or D1.
  • Seconds print as MM:SS under an hour and H:MM:SS above it; the close second itself reads 00:00.
  • A one-second timer runs the same pass that OnInit runs, and a chart change runs it once more, so a resize or a new DPI re-lays the panel out.
  • The alert path returns while the lead is 0 or every channel is off; with a lead and a channel on, the bar in progress at attach is recorded as announced, and each later bar sends once, on the first pass inside the lead window that has a bid.

Inputs

  • Panel corner - the chart corner that holds the panel; a value outside the four corners falls back to the top right.
  • Base font size in points - 8 to 16; the broker row is drawn two points larger and the local row one point larger, and the panel is 200 by 128 logical pixels at the shipped 9 points.
  • Alert lead in seconds - how long before the candle closes the alert goes; 0 turns the alert off, and the value is clamped to 0 to 3600.
  • Popup alert - the message appears as a terminal alert.
  • Push notification - sends the same line to the terminal's push channel.
  • Email - sends the same line by mail.
  • Sound - plays alert.wav.

How to use it

  • The entry carries three files: Broker_Clock.mq5 and the two headers it includes, Brand.mqh and Common.mqh. Put the headers in MQL5/Include/chimaster, the .mq5 in MQL5/Indicators, and compile it; the shipped build gave 0 errors, 0 warnings on MetaEditor 5.0.0.6328.
  • Attach it to any chart: it opens in the top right corner with the base font at 9 points and the alert off.
  • Read the broker row first, then the local row and the offset: the offset is broker minus local, so a broker five hours behind prints -5h 00m.
  • Set a lead and tick a channel; the panel header then reads alert 300s for a 300-second lead, or alert off.
  • Check the download before compiling: Broker_Clock.mq5 is 20,902 B with SHA-256 804531066ea2e79c2e8249615b205309ba98db9891bdab0805ae00a01bc7968a.

Limits

  • It reports and draws: it places no order, changes no chart setting and stores nothing between runs.
  • The zone is TimeLocal() minus TimeGMT(), the terminal's own idea of your clock; a terminal set to the broker's zone prints the same hour on both rows and an offset of 0h 00m.
  • The offset and the zone are rounded to the minute, so a stray second prints the minute a trader reads on a clock.
  • The countdown follows the server clock: when the last tick is more than ten minutes old the row reads Market closed, and it does not predict when the market reopens.
The panel on EURUSD M15 at the shipped defaults: the broker clock, the local clock with its GMT zone, the offset between them, and the candle countdown.
TradeDiagnostics - include file that explains why an EA cannot open a trade TradeDiagnostics - include file that explains why an EA cannot open a trade

One function call checks the terminal, account, program permission, symbol, trading session, quotes, spread, volume and margin, and tells you in plain words why a new trade cannot be opened. No order is ever sent.

Spread Monitor Alert Spread Monitor Alert

Spread monitor for Gold (XAUUSD) and any symbol on MT5. Shows the spread now, its average and the highest of the day in a small panel and alerts when the spread opens above your limit or above twice the average. Open source code.

ADR Levels: Average Daily Range, range used in percent, projected high and low (no repaint) ADR Levels: Average Daily Range, range used in percent, projected high and low (no repaint)

Average Daily Range from finished days, ADR high / low projected from today's low and high or from the open, range used in percent, a small panel and alerts at 80 / 100 percent. Day from broker or New York time. No repaint.

Candlestick Pattern Scanner with honest statistics (engulfing, pin bar, stars, no repaint) Candlestick Pattern Scanner with honest statistics (engulfing, pin bar, stars, no repaint)

Seven candlestick patterns with exact rules, trend / swing / size filters against clutter, and a statistics table that compares every pattern with the base rate of the same chart. Closed candles only, no repaint, buffers for EAs.