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.

See How It Works

Version 4.4 · 2026 · Race Condition Fixed · Production Ready

4Pipeline Stages
Retry Attempts
0Missed Triggers
$0Cost Forever
100%Configurable

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.

01

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 trigger
02

Stage 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%
03

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%
04

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 default

Everything 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 / LOCK

Smart 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 PANEL

Flexible 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 FILTER

Trailing 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-ACCURATE

CSV 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 TRAIL

Spread 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-PAUSE

Broker 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 AWARE

Persistent 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 STATE

What 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.

Old Approach

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.

// ❌ OLD: dangerous pattern if (MoveSL(ticket, newSL)) { SetFlag(ticket, "done", true); // too late } // If MoveSL fails → flag not set // Next tick: price below trigger // Stage never fires again → dead
ACE Guard v4.4

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.

// ✅ ACE GUARD v4.4: safe pattern SetFlag(ticket, "done", true); // FIRST for (attempt = 1; attempt <= 3; attempt++) { if (!SelectByTicket(ticket)) { Sleep(200); continue; } if (PositionModify(ticket, newSL)) { return true; // success } Sleep(200); }

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.

Early Protection

EarlyTriggerPoints

Profit (points) to trigger early SL

500

EarlySLMode

How to move SL at this stage

LOCK_POINTS

EarlyLockPoints

Points of profit to lock in

100
TP1 Partial Close

TP1TriggerPoints

Profit (points) to trigger TP1

1000

TP1ClosePercent

% of position to close at TP1

50

TP1SLMode

How to move SL after TP1

BREAKEVEN
TP2 Partial Close

TP2TriggerPoints

Profit (points) to trigger TP2

1600

TP2ClosePercent

% of position to close at TP2

50

TP2SLMode

How to move SL after TP2

LOCK_POINTS
Trailing Stop

TrailingDistance

Points behind price to trail SL

300

TrailingStep

Min move before trail updates

50

TrailingActivation

Trigger mode: after TP2 or custom pts

AFTER_TP2
Spread & Safety

MaxSpreadPoints

Pause all actions above this spread

30

MagicNumber

0 = manage all trades

0

ManageManualOnly

true = ignore EA trades

false
Logging

EnableCSVLog

Write action log to MQL5/Files

true

LogFileName

Prefix for log file names

ACEGuard

Why ACE Guard

vs Everything Else

FeatureACE GuardOthers
Race condition protectionFlag-before-action + 3x retryNone / flag after
Partial close stages2 independent stages (TP1 + TP2)1 or none
SL move modes per stage4 modes, per stageBreakeven only
Trailing stopTick-accurate, configurableSometimes
Broker stops complianceAuto-checked every modificationError 4756
Persistent state memoryMT5 GlobalVariablesLost on restart
CSV audit logPer-symbol, every actionRarely
Cost$0 — free forever$50 - $300/yr
Free Forever

Download
ACE Guard

The only MT5 trade manager with race condition protection built in from the ground up.

MT5 EA (.ex5)Windows VPSAny BrokerNo License Key