Version 1.00 · MetaTrader 5 · Expert Advisor utility
Funded Account Guardian watches a whole funded (prop firm) account where several Expert Advisors, or you, are trading. It applies the firm's daily loss and maximum loss rules and acts before they are broken:
- Soft limit: pending orders are deleted and any new position is closed at once; open positions are kept.
- Hard limit: every position is closed and every pending order deleted.
It never opens trades on your account, does not change your EAs and shows its state in a small read-only panel. In the Strategy Tester only, it opens sample trades (input Strategy Tester only: sample trades) so that the demo shows the limits at work; switch it off to test it together with your own EA.
Important: the presets follow the rules the firms publish (checked in November 2026), but firms change their rules and accounts differ. Check the rules of your own account and the guardian's settings before you rely on it. The guardian reduces the risk of breaking a rule; it cannot remove it (gaps, slippage, a disconnected terminal).
1. Installing
- Get the EA from the MQL5 Market inside MetaTrader 5 (Toolbox → Market → Purchased).
- Turn on Algo Trading on the toolbar.
- Drag Funded Account Guardian from Navigator → Expert Advisors → Market onto one chart of the account. Any symbol and timeframe: it guards the whole account. Use only one guardian per account.
- On the Common tab tick Allow Algo Trading; on the Inputs tab enter at least Initial account size and choose your firm and program; press OK.
The terminal must stay open and connected (a VPS is recommended): the guardian acts only while it runs.
Before the first start, read section 4: with wrong settings the guardian can lock the account or, on a real account, close positions. As a safety, it does not start if the initial size is 0, and on a first start it does nothing if the equity is already under the hard limit (that almost always means wrong settings).
2. The panel
| Row | Meaning |
|---|---|
| Title | The firm and program in use. |
| State | Green OK - trading allowed; red LOCKED until the firm's next day or LOCKED; orange BLOCKED: open risk; red NOT PROTECTED: ... when it cannot close anything (Algo Trading off, disconnected...). The reason is shown in brackets. |
| Equity / day base | Current equity, and the base of the firm's day the daily limit is measured from. |
| Daily floor | Equity at which the firm's daily rule is broken, and the distance to it (money and % of the initial size). |
| Max floor | Equity at which the firm's maximum loss rule is broken, and the distance to it. The binding floor is shown brighter. |
| Soft limit / Hard limit | The guardian's own levels, above the binding floor, and the distance to them. |
| Open risk | What the account would lose if every stop loss were hit; positions without SL if some have none. |
| Firm's time | The time in the firm's clock (server or Prague time). |
The panel cannot be dragged (so it cannot be moved by accident); choose its corner with Panel corner.
3. What the guardian does
Every second, and on every tick and trade
- Works out the firm's day (00:00 server time or 00:00 Prague time, as the firm does) and, at the start of a new day, takes the balance and equity of that moment as the day's base.
- Computes the daily floor and the maximum loss floor; the higher one is binding.
- Compares the equity with the soft and hard levels:
| Equity reaches | The guardian | Lock lasts |
|---|---|---|
| Soft limit | Deletes pending orders, closes any position opened from then on, keeps the others | Daily rule: until the firm's next day. Maximum loss: permanent |
| Hard limit | Closes every position and deletes every pending order (all closes sent at once) | Same |
| Profit target (optional) | Closes everything | Permanent |
A permanent lock is cleared only by you: set Clear a permanent lock on start to true once (and back to false).
Locks survive restarts
The state is kept in the terminal's global variables: after a restart of the terminal or of the EA, a lock is still in force and the day's base is rebuilt from the history of the day.
Why it closes new positions instead of blocking them
An Expert Advisor cannot stop other EAs from sending orders, and the MQL5 Market does not allow the DLLs that would switch Algo Trading off. So, while locked, any new position is closed as soon as it appears (in the demo tests: 11 milliseconds). Your EAs may show "position closed" messages: that is the guardian.
Only some EAs
Only these magic numbers (for example 1234,5678; 0 = manual trades) limits what the guardian deletes and closes. The limits are still computed on the whole account's equity, because the firm measures it that way.
Example
Custom rules: initial size 100,000; daily loss 5 % of the initial size; the day's base is the start-of-day balance; maximum loss 10 % static. Soft 1.5, hard 0.5 (the defaults).
- The day starts with a balance of 102,000: daily floor = 102,000 - 5,000 = 97,000; maximum floor = 90,000. The higher one counts: 97,000.
- Soft limit = 97,000 + 1.5 % of 100,000 = 98,500. When the equity falls to 98,500, pending orders are deleted and new positions are closed; the open ones stay.
- Hard limit = 97,000 + 0.5 % of 100,000 = 97,500. When the equity falls to 97,500, everything is closed. The 500 left to the firm's floor is the room for slippage while closing.
- The next day starts with the balance after those closes (say 97,600): the new daily floor is 92,600, and the lock is lifted.
4. Settings
Account rules
| Input | Meaning |
|---|---|
| Firm and program | FTMO 2-Step, FTMO 1-Step, The5ers High Stakes, The5ers Hyper Growth, FundedNext Stellar 2-Step, FundedNext Stellar 1-Step, FundingPips 2-Step Standard, FundingPips 2-Step Pro, or Custom. |
| Initial account size | The size of the funded account (100000 for a 100k account). Required. All percentages refer to it. |
| Close all and lock at this profit | Profit target in % of the initial size (0 = off). |
Presets
| Preset | Daily loss | of | measured from | day starts | Max loss | type |
|---|---|---|---|---|---|---|
| FTMO 2-Step | 5 % | initial size | start-of-day balance | 00:00 Prague | 10 % | static |
| FTMO 1-Step | 3 % | initial size | start-of-day balance | 00:00 Prague | 10 % | trailing end of day |
| The5ers High Stakes | 5 % | day's base | higher of balance and equity | 00:00 server | 10 % | static |
| The5ers Hyper Growth | 3 % (daily pause) | day's base | higher of balance and equity | 00:00 server | 6 % | static |
| FundedNext Stellar 2-Step | 5 % | initial size | start-of-day balance | 00:00 server | 10 % | static |
| FundedNext Stellar 1-Step | 3 % | initial size | start-of-day balance | 00:00 server | 6 % | static |
| FundingPips 2-Step Standard | 5 % | day's base | higher of balance and equity | 00:00 server | 10 % | static |
| FundingPips 2-Step Pro | 3 % | day's base | higher of balance and equity | 00:00 server | 6 % | static |
Trailing end of day: the maximum loss floor rises with the highest balance at the end of a day and never falls.
Custom rules (used when the preset is Custom)
| Input | Options |
|---|---|
| Daily loss limit (%) | 0 = no daily rule |
| Daily limit is a % of | the initial capital, or the day's base |
| Daily limit is measured from | the balance at the start of the day, or the higher of balance and equity then |
| The firm's day starts at | 00:00 server time, or 00:00 Prague time |
| Maximum loss (%) | 0 = no maximum loss rule |
| Maximum loss type | static, or trailing the highest end-of-day balance |
Protection
| Input | Default | Meaning |
|---|---|---|
| Soft limit | 1.5 | % of the initial size above the firm's floor. |
| Hard limit | 0.5 | % of the initial size above the firm's floor; must be lower than the soft limit. |
| While locked, close any new position at once | true | Turn off only if you just want the alerts. |
| Block new trades if all stop losses could reach the soft limit | false | While the equity minus the open risk is under the soft limit, new positions are closed. |
| Only these magic numbers | empty | Empty = everything on the account. |
Choosing the hard limit: between the moment the hard limit is crossed and the moment the positions are closed, the price keeps moving (spread, slippage, news). The hard margin must cover that move for all your open exposure. In the demo test (two 1-lot positions closed one after the other in 0.34 seconds, before the closes were sent at once), the equity ended 35 USD under the hard limit, 18 USD above the firm's floor. As a guide: at least the money that 5–10 pips of your largest total exposure represent, and more around news.
Spread at the daily rollover: around the broker's day change (and on thin markets) spreads widen for a few minutes, and the equity of the open positions drops by that much. The firms measure the equity the same way, so the guardian reacts to it too: a soft or hard limit can be hit by the spread alone. Keep the margins wide enough, or have your EAs avoid holding large positions through the rollover.
Options
| Input | Default | Meaning |
|---|---|---|
| Close everything on Friday before the weekend | false | For accounts that do not allow holding over the weekend. |
| ... from this server time | 21:30 | HH:MM, server time. |
| Server time = New York time + N hours | 7 | Used to work out Prague time; 7 for most MetaTrader 5 brokers (GMT+2 / GMT+3). |
| Clear a permanent lock on start | false | See section 3. |
| Pop-up alerts / Push notifications / E-mails | on / off / off | Push and e-mail need to be set up in Tools → Options. |
| Show the status panel / Panel corner | true / upper left |
5. Messages
The guardian writes to the Experts tab. Each message starts with "Funded Account Guardian:".
| Message | Meaning |
|---|---|
| "enter the initial account size ... (it is 0). Nothing is guarded." | Enter Initial account size. |
| "the equity ... is already under the hard limit ... Nothing has been closed and nothing is guarded." | First start with settings that do not fit the account: check the initial size and the preset. |
| "the soft limit must be above the hard limit." | Fix the two margins. |
| "... LOCKED until the next day (daily loss: soft limit)" | Soft limit reached. |
| "... (daily loss: hard limit)" / "(maximum loss: hard limit)" | Hard limit reached; everything closed. |
| "... OK (new day)" | The firm's new day lifted a daily lock. |
| "... (lock from before the restart)" | A lock kept from before a restart. |
| "WARNING: it cannot close or delete anything: ... The account is NOT protected." | Disconnected, Algo Trading off, "Allow Algo Trading" not ticked, investor password, or EAs not allowed by the broker (told after 10 s). Fix it at once. |
| "it can trade again: the account is guarded." | The problem above is solved. |
| "started during the firm's day: the equity at the day's start was not seen ..." | Presets whose day base is the higher of balance and equity: today the base is the start-of-day balance, marked "(est.)" in the panel. Exact from the next day. |
| "... (closed before the weekend)" | Everything closed on Friday at the time set. |
| "position ... not closed: " / "order ... not deleted" | The broker refused a close (market closed, requote...). It is retried every second. |
6. Testing it on a demo
Before using it on a funded account, try it on a demo account with small limits so that they trigger with little movement: preset Custom, initial size = the demo balance, daily loss 0.5 %, soft 0.3, hard 0.1, magic numbers 0 (only manual trades). Then open a manual position and watch the soft limit, a new position being closed, the hard limit and the lock after a restart.
7. Trademarks
FTMO, The5ers, FundedNext and FundingPips are trademarks of their owners. This product is not affiliated with, endorsed by or sponsored by any of them; their names only say which published rules a preset follows.


