End Of Day Reconciliation Daemon
A manual end-of-day routine has an easy failure mode: an interruption partway through (a phone call, a crash, a forgotten step) leaves that day looking done when it is not, because nothing records that it was interrupted. This EA runs the close routine as a persisted four-step state machine - RECONCILE (sums today's closed-trade results and compares the day's realised balance movement against a day-start baseline, flagging any gap beyond a declared tolerance), SNAPSHOT (records current balance/equity/open-position count), BACKUP (copies the running audit log to a dated file), and REPORT (writes a human-readable daily summary tying the previous three together). The state (date and current step) is written to disk after every single step transition, so a terminal restart mid-sequence resumes from exactly where it stopped rather than silently treating a half-finished day as done. A step only advances once its own output was actually produced - a failed file write is logged as FAILED and retried on the next timer tick, not skipped. If a day rolls over into the next while still incomplete, that fact is logged loudly (and alerted) before the new day begins, so an incomplete day is never quietly absorbed into the next one. Notes and limitations Reconciliation compares against a day-start balance captured when this EA first observes a new date - if it is attached mid-day, that baseline is the balance at attach time, not midnight, and the report says so. A deposit or withdrawal made during the day is a legitimate cause of a flagged mismatch this daemon cannot independently verify; it is reported as a finding for a human to check, not treated as an error. This EA never trades and never closes an order - it only reads, computes, and writes files. BACKUP copies the audit log with FileCopy() inside the MQL4\Files\ (or MQL5\Files\ on the native MQL5 build) sandbox; it cannot copy files outside that sandbox.
Expert advisor · MT4 · v1.0 · Free
About End Of Day Reconciliation Daemon
End Of Day Reconciliation Daemon is a script for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 8 settings, such as Close hour, Close minute and Retry seconds. MQL source code included.
Files in the download: EodReconciliationDaemon.ex4, EodReconciliationDaemon.mq4, EodReconciliationDaemon.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Close hour | 23 | Server-time hour the daily close routine becomes due |
| Close minute | 55 | Server-time minute the daily close routine becomes due |
| Retry seconds | 10 | Seconds between retry attempts on a failed step |
| State file | EodReconciliationDaemon_state.txt | File written under MQL4\Files\ |
| Log file | EodReconciliationDaemon_log.csv | File written under MQL4\Files\ |
| Report prefix | EodReport_ | Daily report filename prefix, date appended |
| Backup prefix | EodBackup_ | Daily backup filename prefix, date appended |
| Reconcile tolerance | 1.00 | Account-currency tolerance before a reconciliation mismatch is flagged |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the script onto a chart to run it once.
Tags: Alerts · MT4 Expert Advisor · MQL4 Source Code