Loading…

Session Schedule Anomaly Alarm

MQL4 has no function that returns a broker's actual session hours - there is no MarketInfo() mode and no built-in schedule to read. A trader who wants to be told "this symbol didn't open on time today" has to supply the published schedule themselves and have something watch for it. That is what this EA does. It compares the account's tick stream against two user-declared times - a session open and a session close, both server time - for the weekdays declared active. If no tick has arrived by a configurable number of minutes after the expected open, it logs and alerts LATE_OPEN. If ticks have already gone quiet for a configurable number of minutes before the expected close, it logs and alerts EARLY_CLOSE. Both checks run on a timer, independent of tick flow, so a late open (which by definition has no ticks yet) is still detected on schedule. Every event is appended to a CSV log with the last known tick time and a plain-language detail string, giving a durable record of session-timing anomalies across weeks without anyone needing to watch the chart in real time. Notes and limitations Lateness and earliness are inferred purely from tick arrival, not from any broker-reported session state - MQL4 has none to read. A genuinely quiet market near the open or close can look identical to a real session-timing problem from tick flow alone; this tool flags the pattern, it does not confirm the cause. Cross-check a flagged day against the symbol's own news/calendar before assuming a broker fault. The schedule itself is only as accurate as what the trader typed in - it is never read from the broker, and does not adjust automatically for daylight-saving shifts on either side. This EA never trades and never modifies an order - it only reads tick timing.

Expert advisor · MT5 · v1.0 · Free

About Session Schedule Anomaly Alarm

Session Schedule Anomaly Alarm is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 12 settings, such as Session open time, Session close time and Late open tolerance minutes. MQL source code included.

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

Settings

SettingDefaultWhat it does
Session open time08:00Published session open, server time HH:MM
Session close time17:00Published session close, server time HH:MM
Late open tolerance minutes10Minutes past open before a late-open alarm fires
Early close tolerance minutes10Minutes of silence before close counted as early-close
Active mondaytrue
Active tuesdaytrue
Active wednesdaytrue
Active thursdaytrue
Active fridaytrue
Poll seconds15How often the schedule is checked
Alert on anomalytrueTurn this alert on or off
Log file nameSessionScheduleAnomaly.csvFile written under MQL5\Files\

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: Trading Sessions · Alerts · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria