Account Guard Prop Firm Rules
- Утилиты
-
Ali Akbar
Hi, I'm Ali. 24 years old, trading for around 5 years, and developing MQL5/MQL4 tools. I mainly work on automating manual strategies, fixing broken EA logic, and building clean indicators. I care more about clean architecture and proper risk management than over-complicated code. Always down to talk - Версия: 1.0
- Активации: 5
Account Guard watches your account and does one job. When a limit is reached it closes every position and every pending order. It keeps closing any new trade until the lock ends. It opens no trades of its own. It works for manual trading and for any EA on the same account.
I built it from a set of tested modules. Each module came out of my own MQL5 articles about trading days, drawdown peaks, open risk, and order checks.
What it checks
- Daily loss limit (percent or money, the stricter one wins): Day lock. Every trade is closed until the next trading day.
- Maximum drawdown (static, trailing, or trailing that stops at the initial balance): Full lock. Every trade is closed until you press Reset lock.
- Daily profit target: Day lock, so a good day is not given back.
- Account profit target: Full lock, for a challenge that is already passed.
- Minimum margin level: Every position is closed. No lock.
- Open risk at the stop losses: Warning when it is above your limit or above what is left of the daily limit.
A warning comes first at a level you choose (80% of a limit by default). Alerts can go to the terminal window, to your phone, and by email.
The trading day starts when your firm says it does
Many guards reset the day at a fixed server hour. Many prop firms reset it at midnight in Central Europe or at 17:00 in New York. Both of those move with daylight saving time, and they do not move on the same dates as your broker's server. A fixed hour is then wrong for some weeks of every year.
Account Guard computes the day start in the firm's own time zone. You choose from four starts: server midnight, 17:00 New York, midnight Central Europe, and midnight UTC. You also enter the server's UTC offset and daylight saving rule. The panel warns you when the live server clock does not match what you entered.
Deposits are not profit and withdrawals are not losses
The daily result and the drawdown both leave out money that moves in or out of the account. This covers deposits, withdrawals, credit, and bonus deals made after the guard started. A withdrawal never trips the daily limit, and a deposit never hides a loss.
A lock survives a restart
The lock and the day start values are saved in a small file with a checksum. If the terminal closes or the VPS restarts in the middle of a locked day, the lock is back the moment the guard starts again. In my live test on a demo account, the first trade after a restart was closed by the restored lock.
What I measured
On a MetaQuotes demo account (build 6272, hedging), a test EA kept opening 1 lot trades on purpose while the guard was locked. The guard closed all 35 of them. The closing deal came 0.15 to 0.8 seconds after the opening deal, with a median of 0.16 seconds. Speed depends on your connection and broker, so treat these numbers as one example and not a promise.
In the Strategy Tester (EURUSD M1 real ticks, August and September 2026, 1 lot, a 2% daily limit), the guard set 22 day locks in 43 days. It closed 465 trades that a careless EA opened during a lock. On one day the loss went 96 USD past the 200 USD limit before the lock. That was the US jobs report, where price jumped between two ticks.
What it cannot do
Please read this part before you buy.
- It cannot stop another EA from sending an order. MetaTrader does not allow that without DLLs, and Market products cannot use DLLs. The guard closes the trade right after it opens instead. Each of those trades still costs a spread and a commission. In one tester run a careless EA kept reopening after a full lock and lost 2,246 USD in costs alone. For this reason there is an option to close the charts of other EAs when a lock starts.
- A price gap can push the loss past your limit before the guard can act. News releases and weekend gaps are the usual cause. Set your limit with a buffer.
- The very first close request can fail with "invalid request" when it is sent in the same millisecond as the opening deal. The guard retries half a second later.
- Daylight saving rules are built in for the US and the EU (northern hemisphere). Other rules are not covered.
- I tested it on hedging accounts. Netting accounts were not tested yet.
- The firm presets are starting points. Firms change their rules, so check your firm's current rules and set the inputs to match them.
- When the guard starts in the middle of a day, the equity at the day start is not known. The guard uses the equity at its start and says so on the panel.
Setup in four steps
1. Attach Account Guard to one chart of the account. Any symbol works.
2. Enter your limits. Leave the initial balance at 0 to use the balance at the first start.
3. Choose your firm's day start, then enter the server's UTC offset and daylight saving rule. Check that the panel shows no clock warning.
4. Allow Algo Trading. Keep the terminal running, because the guard can only act while it runs.
Inputs
The inputs are grouped as Account, Daily loss, Maximum drawdown, Targets, Exposure, Trading day, On a lock, and Alerts and panel. Every limit set to 0 is off.
The panel has three buttons. Close all closes everything now. Lock locks the account until you reset it. Reset lock clears a lock, although a limit that is still hit locks again at once. Each button asks you to confirm first.
A free version, Account Guard Daily Limit, has the daily loss limit and the static drawdown, so you can test the guard on your own account first.
