MT5 Expert Advisor · Free Forever · v4.4
ACEGuard
A 4-stage automated trade manager for MetaTrader 5. Protect profits, execute partials, trail survivors — with military-grade reliability and zero missed triggers.
Version 4.4 · 2026 · Race Condition Fixed · Production Ready
How It Works
The 4-Stage
Protection Pipeline
Every trade you open is automatically enrolled into a sequential protection pipeline. Each stage fires once and locks in — no duplicates, no misses.
Stage 01
Early Protection
The moment a trade moves into profit, ACE Guard locks in a protected stop loss — before the market can pull it back to loss.
Default: +500pt triggerStage 02
TP1 Close
Automatically closes a portion of your trade at your first target, banking real profit while keeping a runner alive for more.
Default: +1000pt, close 50%Stage 03
TP2 Close
A second partial close at your extended target. Move the stop loss to lock deeper profits. The remaining position continues to run.
Default: +1600pt, close 50%Stage 04
Trailing Stop
Once unlocked, a configurable trailing stop follows price, squeezing maximum value from every runner until the market turns.
Activates after TP2 by defaultEverything Included
Full Feature Set
— Zero Cost
Every setting you would expect from a premium trade manager, free and fully configurable.
4 SL Move Modes
At each pipeline stage, choose how the stop loss moves: do nothing, breakeven, breakeven + buffer, or lock a fixed profit in points. Per stage. Fully independent.
NONE / BE / BE+BUFFER / LOCKSmart Partial Closes
TP1 and TP2 can each close any percentage of the original or current lot. Small lot safety: if the remaining size is too small for a partial, the full position closes cleanly.
CONFIGURABLE %Visual On-Chart Panel
A live dashboard displays every managed trade: direction, lot size, profit in points, current stage, SL level, and floating P&L — all updating in real time on the chart.
REAL-TIME PANELFlexible Trade Targeting
Manage all trades, manual trades only, or only trades matching a specific magic number. Filter by direction: BUY only, SELL only, or both. Full control over what gets managed.
MAGIC NUMBER FILTERTrailing Stop Engine
Activate trailing after any stage or at a custom points threshold. Set your trailing distance and step size. The trailing engine runs every tick, never overshoots.
TICK-ACCURATECSV Trade Logging
Every action — SL move, partial close, retry attempt — is written to a CSV log file per symbol. Full audit trail of the EA's decision history for your review at any time.
FULL AUDIT TRAILSpread Protection
Set a maximum spread threshold. When the spread exceeds your limit, all EA actions pause automatically — no trades modified or closed during abnormal spread conditions.
AUTO-PAUSEBroker Stops Compliance
ACE Guard reads your broker's minimum stops level on every SL modification attempt. If the new SL would violate the broker rule, it skips gracefully rather than generating an error.
STOPS LEVEL AWAREPersistent State Memory
Stage flags are stored as MT5 GlobalVariables. An EA restart, chart change, or MT5 reconnect won't re-fire stages that already completed.
GLOBAL VARIABLE STATEWhat Makes v4.4 Different
Race Condition
Eliminated
Most trade managers fail silently when MT5's internal position manager is busy at the exact tick a stage triggers. ACE Guard v4.4 solves this with two architectural fixes.
Flag After Action
Previous EAs detect the trigger, attempt the action, and only set the "done" flag if it succeeds. When MT5 rejects the action (Error 4752: position briefly locked), the flag stays unset. On the next tick, price may have moved below the trigger — the stage never fires again.
Flag Before Action
ACE Guard sets the stage flag immediately when the trigger fires — before attempting any action. The trigger moment is permanently captured. Then a 3-attempt retry loop with a 200ms gap re-selects the position fresh each time. No trigger is ever lost.
Configuration Reference
Every Setting
Explained
ACE Guard ships with sensible defaults for XAUUSD 5m. Every value is adjustable from the EA inputs panel in MT5.
EarlyTriggerPoints
Profit (points) to trigger early SL
EarlySLMode
How to move SL at this stage
EarlyLockPoints
Points of profit to lock in
TP1TriggerPoints
Profit (points) to trigger TP1
TP1ClosePercent
% of position to close at TP1
TP1SLMode
How to move SL after TP1
TP2TriggerPoints
Profit (points) to trigger TP2
TP2ClosePercent
% of position to close at TP2
TP2SLMode
How to move SL after TP2
TrailingDistance
Points behind price to trail SL
TrailingStep
Min move before trail updates
TrailingActivation
Trigger mode: after TP2 or custom pts
MaxSpreadPoints
Pause all actions above this spread
MagicNumber
0 = manage all trades
ManageManualOnly
true = ignore EA trades
EnableCSVLog
Write action log to MQL5/Files
LogFileName
Prefix for log file names
Why ACE Guard
vs Everything Else
| Feature | ACE Guard | Others |
|---|---|---|
| Race condition protection | Flag-before-action + 3x retry | None / flag after |
| Partial close stages | 2 independent stages (TP1 + TP2) | 1 or none |
| SL move modes per stage | 4 modes, per stage | Breakeven only |
| Trailing stop | Tick-accurate, configurable | Sometimes |
| Broker stops compliance | Auto-checked every modification | Error 4756 |
| Persistent state memory | MT5 GlobalVariables | Lost on restart |
| CSV audit log | Per-symbol, every action | Rarely |
| Cost | $0 — free forever | $50 - $300/yr |
Download
ACE Guard
The only MT5 trade manager with race condition protection built in from the ground up.