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
| Setting | Default | What it does |
|---|---|---|
| Session open time | 08:00 | Published session open, server time HH:MM |
| Session close time | 17:00 | Published session close, server time HH:MM |
| Late open tolerance minutes | 10 | Minutes past open before a late-open alarm fires |
| Early close tolerance minutes | 10 | Minutes of silence before close counted as early-close |
| Active monday | true | |
| Active tuesday | true | |
| Active wednesday | true | |
| Active thursday | true | |
| Active friday | true | |
| Poll seconds | 15 | How often the schedule is checked |
| Alert on anomaly | true | Turn this alert on or off |
| Log file name | SessionScheduleAnomaly.csv | File written under MQL5\Files\ |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Trading Sessions · Alerts · MT5 Expert Advisor · MQL5 Source Code