Rogue Expert Detector
Running several EAs on one account works until one of them stops behaving the way it was configured to - a parameter change that did not take, a crash that left a position open past its own rules, a stray magic number from a test run left running by mistake. By the time a human notices, the account has been carrying unexpected risk for however long nobody was watching. This declares a policy per magic number - how many lots it is allowed to hold in total, and how many positions it is allowed to hold at once - as a simple semicolon-separated list, then scans the order pool on a timer and compares what is actually open against what was declared. A magic number that exceeds either limit is flagged; a magic number holding a position at all that was never declared is flagged too, on the theory that an EA nobody told this tool about is exactly the kind of surprise worth knowing about immediately. Like every program in this catalogue, it cannot reach into another EA's OrderSend call and refuse the trade - there is no such hook in MQL4. It only detects and alerts, with repeat alerts throttled so a standing violation does not flood the log. Notes and limitations - Detection only. This cannot block, modify or close a position belonging to another EA, and cannot stop the offending order from being sent in the first place - MQL4 gives no program a hook into another's OrderSend call. - The lot-size cap is checked against the SUM of open lots for a magic number, not any single order, so several small positions can still trip the cap the same way one large one would. - A malformed InpPolicyConfig row fails initialization outright rather than silently ignoring the bad row - fix the format and reattach.
Expert advisor · MT5 · v1.0 · Free
About Rogue Expert Detector
Rogue Expert Detector is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 4 settings, such as Policy config, Alert undeclared and Scan interval sec. MQL source code included.
Files in the download: RogueExpertDetector.ex5, RogueExpertDetector.mq5, RogueExpertDetector.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Policy config | 0,1.00,3 | Policy list: "magic,maxLots,maxPositions;magic,maxLots,maxPositions;..." |
| Alert undeclared | true | Alert if a magic number not in the policy list appears |
| Scan interval sec | 15 | Seconds between scans |
| Realert cooldown min | 10 | Minutes before the same violation is alerted again |
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 · Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code