Prop firm daily loss limit and drawdown guard for MT5: Account Rule Keeper setup guide

14 November 2026, 18:26
Adrian Taylor Spies
0
1
This guide shows how to set up Account Rule Keeper, a MetaTrader 5 utility that enforces a daily loss limit, a maximum drawdown and an optional profit target on the whole account. When a limit is reached, it closes every open position, deletes every pending order and keeps the account flat until the lock ends. It does not open trades on your account and does not make trading decisions. It is not affiliated with any prop firm, and firms define their rules differently, so read your firm's rules and set the inputs to match them.

Product page: https://www.mql5.com/en/market/product/204908

Installation

1. Attach Account Rule Keeper to one chart of the account. Any symbol and timeframe works; it guards the whole account. Attach it only once per account.
2. Allow Algo Trading in the Common tab and enable Algo Trading in the terminal toolbar.
3. Set "Initial balance (0 = balance at first attach; reset by a clear)" to the account size, for example 100000 for a 100,000 account.

Daily loss limit

Set "Enforce a daily loss limit" to true. "Daily limit unit" chooses percent of the initial balance, percent of the day's reference, or a fixed amount, and "Daily limit value" is the limit in that unit, for example 5 for 5 percent. "Daily loss measured from" chooses the day's reference: the balance at the daily reset, the equity at the reset, or the higher of the two. "Daily reset hour (server time)" and "Daily reset minute (server time)" set when the trading day starts, in the broker's server time. A daily loss breach locks the account until the next daily reset.

Maximum drawdown

Set "Enforce a maximum drawdown" to true. "Drawdown type" chooses a floor that is static from the initial balance, or one that trails the highest equity or the highest closed balance; "Trailing floor stops rising at the initial balance" stops a trailing floor there. "Drawdown unit (percent units use the initial balance)" and "Drawdown value" set the size. A drawdown breach locks the account until you clear the stored state.

Profit target, buffer and warnings

"Close all and lock when the target is reached" with "Target unit (percent units use the initial balance)" and "Target value" sets an optional profit target. "Act early by this percent of the allowance" makes the guard act a little before a limit, so slippage while closing has room. "Warn when this percent of an allowance is used (0 = off)" raises a warning in the terminal at most once per trading day for the daily limit and once for the drawdown until the stored state is cleared, and "Also send push notifications to the mobile app" sends the guard's alerts, warnings and breaches included, to the MetaTrader mobile app.

Ending a lock

While locked, any new position, manual or from another Expert Advisor, is closed as soon as it appears. The day's reference, the high-water mark and the locks survive a terminal restart. To end a drawdown or profit target lock, set "Clear stored day reference, high-water mark and locks on start" to true. This also resets the day's reference and the high-water mark, and with "Initial balance (0 = balance at first attach; reset by a clear)" at 0 it takes the current balance as the new initial balance. The clear runs once per true setting; to clear again later, set it to false, apply, then true.

What it cannot do

It cannot stop an order from being sent; it closes positions after they open. It cannot guarantee that equity stays above a limit: gaps, closed sessions, fast markets and rejected orders can move equity past a limit before positions are closed. It works only while the terminal is running with Algo Trading enabled.

Trying the free demo

The free demo runs only in the Strategy Tester. On its own there, the guard has no trades to protect, so it opens random demonstration positions and you can watch it close them at the limits. Run a test with visual mode on to see the status panel, or read the journal: lines starting with ARK|BREACH show each breach and ARK|CLOSE each position the guard closed. The demonstration positions are random and say nothing about any trading result.