Pending Order Conflict Detector
A pending order is placed for a reason, but that reason can go stale. An open position gets closed manually, a strategy flips direction, or two systems with different magic numbers end up working the same symbol without either one aware of the other's resting orders. The result is a pending order that, when it fills, either opens directly against existing exposure or piles more onto a side that is already large - and the only way to notice today is to read every open ticket and every pending order by hand and cross-check them. This script does that cross-check automatically. Every resting pending order is compared against the account's current net open exposure on its symbol and classified as a HEDGE (would open against existing exposure), a DOUBLE (would add to exposure already in the same direction), or neither. Separately, every same-symbol pair of pending orders resting on opposite sides is flagged as well, since firing both would hedge the symbol against itself regardless of what is currently open. Nothing is modified - this is a read-only report, meant to be run before trusting a pending order to fill unattended. Notes and limitations - "Existing exposure" means currently open market positions only, matching the same magic and symbol filters as the pending orders being checked. Other resting pendings are not counted as exposure for this comparison, only for the separate opposite-pair check. - A HEDGE or DOUBLE flag is not automatically wrong - some strategies genuinely intend to scale in, or to hedge deliberately. The script reports the fact, not a verdict, so a deliberate hedge on a hedging account will still be flagged and should be read in that light. - No pending order is modified or cancelled. This is a detection tool only.
Script · MT5 · v1.0 · Free
About Pending Order Conflict Detector
Pending Order Conflict Detector is a script for MetaTrader 5. It can alert you with a pop-up, sound, email or push message. It has 2 settings, such as Magic filter and Symbol filter. MQL source code included.
Files in the download: PendingConflictDetector.ex5, PendingConflictDetector.mq5, PendingConflictDetector.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Magic filter | -1 | Magic number filter (-1 = every magic) |
| Symbol filter | Symbol filter ("" = every symbol in the book) |
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: Hedging · Pending Orders · Alerts · MT5 Script · MQL5 Source Code