Blog

Equity Protector EA: Daily Drawdown Limits in MT5

TradeSmithy Team4 min read

Short answer: an equity protector watches account equity and, when losses reach a limit you set, closes open positions and stops new trades. The common limits are an absolute equity floor, a percentage drawdown from balance, a drawdown from the highest equity reached, and a daily loss limit. The most reliable place for the guard is inside the strategy EA itself, so it can never be forgotten on another chart.

Why equity, not balance?

Balance only changes when a trade closes. Equity includes open profit and loss. An EA holding a losing position can sit at an unchanged balance while equity falls 30% — and it is equity that margin calls, stop-outs and prop-firm rules measure.

Four kinds of equity limit

LimitRuleSuits
Equity floorStop if equity < a fixed amountPersonal accounts with a hard line
Drawdown from balanceStop if equity < balance × (1 − x%)Capping open risk at any moment
Drawdown from peakStop if equity falls x% below its highest levelProtecting accumulated profit
Daily lossStop if today's loss reaches x% of the day's starting balanceProp firms; bad-day protection

A profit lock is the mirror image — close everything when equity reaches a target — and is built exactly the same way.

What "stop" should mean

Decide in advance, because the guard will fire at the worst moment:

  1. Close open positions — all of this EA's positions, immediately.
  2. Block new entries — for the rest of the day, or until you reset it.
  3. Leave a trace — a log line saying the guard fired and why.

Closing without blocking is a common bug: the EA flattens, then reopens on the next signal and hits the limit again.

Inside the EA, or a separate utility?

A standalone "equity protector" EA on its own chart can watch the whole account, including manual trades — useful when several EAs share one account. Its weakness is that it is one more thing to forget to attach after a restart.

A guard inside the strategy EA travels with it: wherever the strategy runs, the limit runs. For most traders running one strategy per account, that is the safer design.

Building the guard into a TradeSmithy strategy

Everything the guard needs is in the graph:

  • Account Info → Equity and Account Info → Balance for the current values.
  • Math Operation nodes for the drawdown percentage.
  • A Comparison against a Global Parameter — your limit, adjustable per account without re-exporting.
  • A Close Order node set to All Positions, which closes this EA's positions.
  • The same condition through a NOT into your entry logic, so nothing reopens.

For a daily limit, store the balance in a Variable once per day from an OnNewCandle branch set to D1; for drawdown from peak, keep the highest equity seen in a Variable. Or describe the guard to the AI assistant in a sentence — "close everything and stop trading if equity falls 4% below today's starting balance" — and check the exported code before relying on it. The prop-firm version of this, including the time-zone catch, is in prop firm EA rules.

Test the guard, not just the strategy

Backtest over a period with a bad stretch and confirm the guard fires where you expect, closes everything, and keeps the EA quiet afterwards. A guard that has never fired in a test is a guard you have not tested. Our MT5 backtesting guide.

Build protection in from the first node

Start free on TradeSmithy and put the equity guard in before the entry logic, not after the first bad week — the Free plan includes the whole builder and one export a month. On Pro, backtest the guard on our servers and ask the assistant to add one to an existing strategy. Pair it with position sizing from balance and stay clear of grid and martingale logic.

Frequently asked questions

What is an equity protector EA?

An EA or EA feature that closes positions and stops trading when account equity falls to a limit.

What is a good daily drawdown limit?

One well inside any rule you are subject to — for a 5% prop-firm limit, around 4% — and small enough that a normal losing day does not reach it.

Does an equity protector work if MetaTrader is closed?

No. It runs in the terminal. Stops already on the server still work, which is one reason every trade should carry a stop loss.

Can an equity protector close trades from other EAs?

A standalone utility can. A guard built into a strategy EA acts on that EA's own trades, which is usually what you want.

Keep reading

← More from the TradeSmithy blog