Lab Prop Guardian is a risk utility for MetaTrader 5. It watches the equity of the account and, when a loss limit is about to be reached, closes the positions and deletes the pending orders. It does not open trades and does not give signals.
This guide explains how to set it up, what each input does, how the numbers are calculated and what the tool cannot do. It describes version 1.0.
1. What it does, in one minute
- Checks the account equity on every tick and once per second.
- Daily loss limit: when today's loss gets close to the limit, it closes everything and keeps closing any new trade until the daily reset.
- Maximum drawdown: when equity gets close to the drawdown floor, it closes everything and stays locked until you reset it.
- Profit target (optional): when equity reaches the target, it closes everything and stays locked.
- Shows a panel with the current status and the room left.
2. Installation
- Install it from the Market tab of MetaTrader 5.
- Attach it to one chart. Any symbol and timeframe will do; it works on the whole account.
- Enable Algo Trading in the toolbar and "Allow Algo Trading" in the EA settings. Without it the Guardian can only show the panel: it cannot close anything.
- Enter your firm's rules in the inputs (section 3) and press OK.
- Check that the panel says ACTIVE - protecting.
Try it first on a demo account with small limits, so you can see a lock happen.
3. Inputs
Account
- Initial account size: the size the firm uses for its percentages (for example 100000). With 0, the Guardian takes the balance it finds the first time it runs on that account and remembers it. If the account already has profit or loss, type the real initial size.
Daily loss limit
- Daily loss limit (%): percentage of the initial size. 0 turns the daily limit off.
- Daily loss limit in money: if greater than 0 it replaces the percentage.
- Daily limit measured from: "Balance at day start", or "Higher of balance/equity at day start". Use the one your firm states in its rules.
- Daily reset hour (server time): the hour, in your broker's server time, at which the trading day starts. It is not your local time. Check the time shown in Market Watch.
Maximum drawdown
- Max drawdown (%) and in money: same logic as the daily limit. 0 turns it off.
- Drawdown mode - Static: the floor is the initial size minus the limit. It never moves. Trailing: the floor follows the highest equity seen, at a distance equal to the limit. Trailing, stops at initial balance: like trailing, but the floor never rises above the initial size.
Profit target
- Profit target (%): percentage of the initial size. 0 turns it off.
Protection
- Safety buffer: the Guardian acts when this percentage of a limit is still left (10 by default). It exists because closing takes a moment and the closing price can be worse than the last one seen.
- Warn when this % of a limit is used: alert at 70 by default.
- Send push notifications: also sends the alerts to your phone. It needs your MetaQuotes ID in Tools - Options - Notifications.
- Max slippage for closing (points).
Filter
- Manage only this chart's symbol and Manage only this magic number (-1 = all trades): limit which trades the Guardian closes. The limits are always calculated on the equity of the whole account; the filter only decides what gets closed. If you are not sure, leave both at their defaults.
- Reset a permanent lock: see section 6.
Panel
- Panel X / Y position.
4. A worked example
Account of 100,000. Daily limit 5%, maximum drawdown 10% static, safety buffer 10%, warning at 70%.
| Limit | Floor | Warning at | The Guardian acts at | |
|---|---|---|---|---|
| Daily (day started at 100,000) | 5,000 | 95,000 | equity 96,500 (3,500 lost) | equity 95,500 or lower |
| Maximum drawdown | 10,000 | 90,000 | equity 93,000 | equity 91,000 or lower |
The Guardian acts 500 before the daily floor and 1,000 before the drawdown floor: that is the buffer.
With a trailing drawdown and a highest equity of 104,000, the floor is 94,000 and the Guardian acts at 95,000.
5. The panel
- Status: ACTIVE - protecting / LOCKED - daily limit / LOCKED - max drawdown / LOCKED - target reached.
- Equity and Today P/L (equity minus the value taken at the daily reset).
- Daily room and DD room: money left before each floor, and the percentage of the limit already used.
- DD floor: the equity level that must not be touched.
- Target: the equity that triggers the profit lock, or "off".
- Managed trades/orders: how many positions and pending orders the Guardian would close.
- The last line reminds you of the buffer in use.
6. Locks
- Daily lock: ends by itself at the next daily reset.
- Drawdown lock and target lock: permanent. To resume, open the inputs, set Reset a permanent lock to true and press OK; then open them again and set it back to false. If you leave it on true, the lock will be cleared every time the EA restarts.
- Resetting does not change the numbers: if equity is still at or below the level, it locks again at once.
- The state (initial size, highest equity, day start, lock) is remembered if MetaTrader is restarted. It is stored in that MetaTrader installation: on another computer or a new installation, enter the initial size again.
7. What it cannot do - please read
- It cannot stop a trade from being opened. MetaTrader does not allow one program to block another. While locked, the Guardian closes a new trade at its next check (every tick, and at least once per second). Each trade opened and closed this way costs spread and commission. If another EA keeps opening trades, turn off Algo Trading or remove that EA.
- It only works while MetaTrader is running and connected. If the terminal or the connection is down, nothing is closed. A VPS is recommended.
- Gaps can use up the buffer. After a weekend, a news release or a fast market, the closing price can be beyond the limit. The buffer reduces the risk; it does not remove it.
- When the market is closed it cannot close. It retries every second and closes when the market opens.
- The day start is taken when the Guardian sees the new day. If MetaTrader was off at the reset hour, it takes the value it finds when it starts. For a correct daily figure, keep the terminal running across the reset.
- Every firm calculates its rules differently (balance or equity, reset hour, trailing or static, what counts as the initial size). You must enter your firm's rules exactly and check them from time to time: they change.
- It is not a guarantee of passing a challenge or keeping an account, and it does not make a strategy profitable.
8. Frequent questions
- Can I use it with another EA? Yes. Attach the Guardian to a separate chart. Read the first point of section 7.
- Does it work on netting and hedging accounts? Yes; it closes position by position.
- The panel does not appear. Check that the EA is attached and that the chart is not covered by another object; change the panel position if needed.
- It did not close anything. Check that Algo Trading is on, and look at the Experts tab for a "close failed" line with the server's return code.
- I changed the account. The state is stored per account number; on a new account type the initial size again.
Lab Prop Guardian MT5 on the Market: https://www.mql5.com/en/market/product/208268
Not financial advice. Past results do not guarantee future results.


