Drawdown Limit Guard
- Utilities
- Version: 1.0
- Activations: 10
Drawdown Limit Guard watches your account against loss limits that you set. It does not decide when to buy or sell. It watches your daily and total loss and, when a limit is reached, it warns you and closes positions — that is all it does.
You set a daily loss limit and a total loss limit, and you can use one of them or both. As the loss gets close to a limit, the tool warns you. When a limit is reached, it closes any position or pending order that opens after that point, and — only if you turn that option on — it also closes the positions that were already open.
Important: this tool cannot stop a new order from opening. There is no function in MetaTrader 5 to switch off new trading, and the Market does not allow DLLs. So when a new order opens after a limit is reached, the tool closes it right after it opens (about a quarter of a second in testing). A small loss from spread and price movement still happens on that order. This is written plainly so there is no misunderstanding.
People use it in two ways:
- To watch a rule of their own, for example "no more than 5% loss in one day".
- To watch the daily and total loss figures used by funded-account programs.
The tool reports and acts on the numbers you give it. Whether any particular rule is met depends on your settings, your trading and your broker, and is outside what this tool can control.
What it watches
- Daily loss: the drop from the balance (or equity) at the start of the trading day.
- Total loss, measured in one of two ways that you choose:
- from your initial balance, or
- from the account's high watermark — the peak value the account has reached. In this mode the reference follows the peak upward and does not move back down, and it stays put even after you resume.
- Calculation basis: Balance or Equity, so it matches the rule you follow.
- Daily reset at an hour and minute you set (server time). The reset follows the calendar, so it also happens on days with no trading.
How it acts (two stages)
- Warning at 80% of the limit (default): an on-screen notice and an alert. Trading is not touched at this stage.
- Stop at 100% of the limit: the panel turns to "Stopped". From this point the tool closes any position or deletes any pending order that opens, until you resume. Positions that were already open when the limit was reached are closed only if you turn on that option — it is off by default, so nothing already open is closed unless you choose it. After a stop, monitoring stays stopped until you resume it by hand.
On-chart panel
- Current daily loss and total loss, the amount and percent remaining to each limit, the time until the daily reset, the peak value, and the current state (Monitoring, Warning, or Stopped).
- Alerts by popup, sound, and push notification to the mobile terminal (each can be turned off).
- A magic-number filter, so you can act on the positions of one EA only, or on all positions.
- State is restored after a terminal restart, so a restart does not reset the day's progress.
What it does not do
- It does not open trades, choose entries, or send trading signals.
- It does not give advice or predict results.
- It cannot stop an order from opening. It closes the order right after it opens, so a small spread and price-movement loss happens on that order (explained above).
- It needs "Algo Trading" enabled in the terminal. Algo Trading is required to close a position, so if it is off, the tool cannot close anything — it tells you when this is the case.
- While the account is still past a limit, "Resume monitoring" does not release it: the next check stops it again at once. Change your settings or wait for the daily reset.
- Only one chart per terminal runs the tool. A second chart is refused, so nothing is closed twice.
- If MetaTrader 5 is closed abnormally, the latest state may not be saved, because the terminal writes it at shutdown.
- If you deposit or withdraw, update the "Initial balance for total loss" input by hand.
No external dependencies
- No DLL, no external website or API, and no third-party server. Everything runs inside your MetaTrader 5 terminal.
How to test in the Strategy Tester
A free demo runs only in the Strategy Tester. In the tester only one EA runs and this tool does not open trades, so there is nothing for it to close on its own — but the loss watching, the panel and the two stages all work. Set the daily limit type to Money with a small value (for example 10) and run a test that produces a loss to see Warning and then Stopped. Run the test in visual mode to watch the panel change as the loss grows. Please note that the tester gives you no way to place an order by hand, so the closing itself cannot be demonstrated there; it runs on a live or demo account.
Inputs (all have default values)
- InpBasis — Calculation basis (Balance or Equity). Default: Equity
- InpInitialBalance — Initial balance for total loss. 0 = use current balance on first start. Default: 0
- InpDailyLimitType — Daily limit type (Percent or Money). Default: Percent
- InpDailyLimitValue — Daily loss limit value. 0 = do not use the daily limit. Default: 5.0
- InpTotalLimitType — Total limit type (Percent or Money). Default: Percent
- InpTotalLimitValue — Total loss limit value. 0 = do not use the total limit. Default: 10.0
- InpTotalAnchor — Total loss is measured from the initial balance or from the high watermark. Default: Initial balance
- InpWarnPercent — Warning threshold as percent of the limit. Default: 80
- InpResetHour — Daily reset hour (server time, 0-23). Default: 0
- InpResetMinute — Daily reset minute (server time, 0-59). Default: 0
- InpLockNewTrades — Close positions and delete pending orders opened after the limit was reached. Default: on
- InpClosePositions — Close positions that are already open when the limit is reached. Default: off
- InpAlertPopup — Show popup alert. Default: on
- InpAlertPush — Send push notification to mobile terminal. Default: off
- InpAlertSound — Play sound on alert. Default: on
- InpPanelCorner — Panel position on the chart. Default: Top left
- InpMagicFilter — Only close positions with this magic number. 0 = all positions. Default: 0
Please note
Trading foreign exchange and CFDs carries a risk of loss. This tool is an operational aid that watches your loss and closes positions at the limits you set. It does not provide trading advice or signals, and it makes no claim about trading results. All trading decisions and their outcomes are your own.
