Daily Loss Guard Pro MT5
- Utilitaires
-
Themistokli Kola
MQL5 developer. I build and fix Expert Advisors, indicators and trade-management tools for MetaTrader 5, and I convert MQL4 and Pine Script code to MQL5.
Published on MQL5: - Version: 1.0
- Activations: 5
Daily Loss Guard Pro MT5 watches your account and stops trading when a limit you set is reached. It closes positions, deletes pending orders and blocks new trades. It never opens a trade itself and gives no signals.
Attach it to any one chart of the account. It works alongside manual trading and other Expert Advisors, and checks every second on a timer, on every tick and on every trade event.
Limits
- Daily loss: in percent or in account currency, based on the day-start balance, the day-start equity, or the higher of the two. It can be measured from the day start, or from the day's highest result (trailing).
- Total drawdown: in percent or in account currency, from the initial balance (static) or from the highest equity reached (trailing). It uses the whole account's equity.
- Profit target: in percent or in account currency above the initial balance. When it is reached, positions are closed and new trades are blocked.
- Daily discipline: a maximum number of new positions per day and a maximum number of losing trades in a row per day. When reached, new trades are blocked until the next day; open positions are closed only if you choose so.
A total drawdown or profit target lock stays until you reset it with the "Reset account lock" input. A daily lock ends at the start of the next trading day.
When the trading day starts
Choose server time, UTC, New York time or London time, and the hour. Summer time is handled. The broker's time zone is found automatically, or you set the offsets by hand.
Warnings and panel
Warnings at 50, 75 and 90 percent of each active limit, once per level per day, as a pop-up and/or a push notification. The panel shows the day (start, basis, limit, result closed and open, percent used, status), the account rules (initial balance, drawdown used, target, lock), the discipline counters and a 10-day history with each day's result, the highest percent of the daily limit used and whether the limit was hit.
Settings
| Group | Inputs and defaults |
|---|---|
| Daily loss | Basis day-start balance; measured from day start; type percent; limit 2.0% (or 100 in account currency); 0 = off |
| Account rules | Initial balance 0 = balance when first attached; total drawdown off, static or trailing; profit target off; reset account lock false |
| Daily discipline | Max new positions per day off; max losing trades in a row off; also close open positions false |
| Day start | Server time, hour 0; broker time zone automatic, or manual winter and summer offsets with US, European or no summer time |
| Action | Close positions true; delete pending orders true; block new trades true; max slippage 20 points |
| Which trades count | Symbols empty = all, or a list such as EURUSD,XAUUSD; magic -1 = all, 0 = manual only. These filters apply to the daily loss and the discipline rules; the account rules always use the whole account. |
| Alerts and panel | Warnings true; pop-up true; push false; panel shown at X 12, Y 20 |
Good to know
- It closes at market price. On fast moves the loss can go past the limit before the close is done. Always use stop losses as well.
- It cannot stop an order from being sent. It closes or deletes a blocked trade right after it appears.
- A failed close or delete (requote, market closed, freeze level, no connection) is retried every 30 seconds until done.
- Algo trading must be enabled in the terminal, and the terminal must stay connected, or the guard cannot close trades. The panel says so when algo trading is off.
- In the Strategy Tester the automatic time zone is not available, so the manual offsets are used.
- It is a risk tool. It does not make a strategy profitable and it does not guarantee that any account or trading rule set is kept. Check your own account rules yourself.
What was tested
Tested on hedging accounts; netting accounts not tested. All tests ran in the MetaTrader 5 Strategy Tester on one demo server. These are tester results on past data. They are not a promise of how it will work on your account.
- Close-all with 3 positions on 2 symbols, where every close was made to fail 3 times: all were retried and closed. Pending orders were deleted at the limit, and a new pending order was deleted as soon as it was placed.
- The day start in server time, UTC and New York time across the 1 November 2026 US clock change: every day reset happened at the expected time.
- 10 normal trading days below the limits: no action by the guard.
- The 50, 75 and 90 percent warnings: in order, once per level per day.
- Each limit above (daily loss on each basis, trailing daily loss, static and trailing drawdown, profit target, maximum trades, losing trades in a row, lock reset) triggered at its level.
What was not tested
- Netting accounts.
- Live accounts and other brokers. Only one demo server was used.
- London time and the European or no-summer-time rules. The day start was tested in server time, UTC and New York time with the US rule only.
- Push notifications. The Strategy Tester cannot send them; pop-up alerts were checked in the tester log.
