Loading…

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

SettingDefaultWhat it does
Close hour23Server-time hour the daily close routine becomes due
Close minute55Server-time minute the daily close routine becomes due
Retry seconds10Seconds between retry attempts on a failed step
State fileEodReconciliationDaemon_state.txtFile written under MQL4\Files\
Log fileEodReconciliationDaemon_log.csvFile written under MQL4\Files\
Report prefixEodReport_Daily report filename prefix, date appended
Backup prefixEodBackup_Daily backup filename prefix, date appended
Reconcile tolerance1.00Account-currency tolerance before a reconciliation mismatch is flagged

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Scripts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 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: Alerts · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria