Config Drift Sentinel
A symbol's contract size can get repointed after a corporate action. Leverage can change mid-session. A stop level or freeze level can shift when a broker updates its symbol specification. None of this shows up as an event anywhere - every strategy that reads MarketInfo() each tick just silently starts computing against different numbers from that moment on. This EA captures ten tracked settings (account leverage, currency and trade mode; the traded symbol's digits, point size, contract size, stop level, freeze level and min/max/step lot figures; the terminal build number), folds them into one FNV-1a 64-bit hash, and stores that hash plus the underlying values as a baseline file on disk. On a timer it re-captures and re-hashes; a mismatch triggers a field-by-field comparison against the stored baseline so the log names precisely which value changed, was, and is now - not just "something drifted". A changed baseline is adopted going forward after being reported once, so a genuine, permanent change (a broker updating a symbol spec) is not re-reported every poll for the rest of the session. Notes and limitations The tracked field list is fixed at compile time - adding a new tracked setting means editing the source and recompiling, by design, so the exact set being watched is always visible in the code rather than configurable at runtime in a way that could itself drift unnoticed. This EA never trades. It only reads account and symbol properties. A terminal restart with the EA reattached picks the stored baseline back up from disk and checks against it immediately, catching any drift that happened while it was not running.
Expert advisor · MT5 · v1.0 · Free
About Config Drift Sentinel
Config Drift Sentinel is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 5 settings, such as Poll seconds, Reset baseline and Baseline file. MQL source code included.
Files in the download: ConfigDriftSentinel.ex5, ConfigDriftSentinel.mq5, ConfigDriftSentinel.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Poll seconds | 5 | How often to re-hash the tracked configuration, seconds |
| Reset baseline | false | true = discard the stored baseline and adopt current config as new baseline on this run |
| Baseline file | ConfigDriftSentinel_baseline.txt | File written under MQL5\Files\ |
| Log file | ConfigDriftSentinel_log.csv | File written under MQL5\Files\ |
| Alert on drift | true | Pop a terminal Alert() the moment drift is detected |
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: Alerts · Trading Sessions · MT5 Expert Advisor · MQL5 Source Code