Prop Firm Guard and Drawdown Lock
- Utilitários
-
Jevon Naldo Yoshield
I build MT5 tools. Seventeen are on the Market: fourteen free, three paid. - Versão: 1.0
Closes your positions and deletes your pending orders when the day's equity drawdown reaches your limit, and closes anything you open for the rest of that day.
FEATURES
- On breach: closes every open position, deletes pending orders, locks the day.
- Panel: drawdown percentage, equity, state.
HOW TO USE IT
1. Enable Allow Algo Trading.
2. Attach it to a chart and set the loss and warning levels.
3. Choose the breach actions.
PARAMETERS
InpDailyMaxLossPercent, InpDailyWarningPercent, InpAutoCloseOnBreach, InpLockTradingOnBreach, InpCancelPendingOrders, InpSendPushOnBreach.
LIMITATIONS
- It does not know your firm's daily loss rules or window.
- The day's base is the balance at attach time.
- The day resets at 00:00 server time. Check your broker's offset.
- The lock closes positions, it does not switch trading off.
- A closed terminal cannot enforce the limit.
COMPATIBILITY
Any MT5 account type. Native MQL5, no DLLs.
SUPPORT
Questions through the MQL5 message system. First reply within two working days.
OPERATIONAL NOTES
- Enable Allow Algo Trading in the terminal. Without it the tool cannot close positions or delete orders.
- It runs on a desktop terminal or a VPS. A closed terminal cannot enforce the limit.
- The day is measured as equity against the balance captured when the tool was attached, or at the start of the next server day. Attaching mid day means the rest of that day is measured from your balance at that moment.
- The day unlocks when the server date changes, at 00:00 server time. Confirm your broker's server offset before relying on it.
- Firm rules differ. The tool does not know your firm's daily loss definition or its time window, so verify your firm's rules and keep a margin between your threshold and the firm's limit.
- With the day lock on, the breach actions run once: positions are closed, pending orders are deleted, the notification is sent and the day is locked. While the day is locked, any position that appears is closed on the next tick.
- If you switch the day lock off, the breach actions run on every tick, so the notification can repeat until the day changes.
- The profit target runs the same actions as the loss limit, so with the day lock on they run once, and with the day lock off they can repeat on every tick until the day changes.
- The lock is enforced by closing positions, not by switching trading off in the terminal. A position opened while the day is locked is closed on the next tick.
- The panel shows the daily drawdown as equity against the day's starting balance.
PARAMETERS IN DETAIL
- InpDailyMaxLossPercent: the daily maximum loss, as a percentage of the day's starting balance. Default 4.5.
- InpDailyWarningPercent: the warning level, as a percentage of the day's starting balance. Default 3.5.
- InpAutoCloseOnBreach: close every open position on the account when the limit is reached. Default on.
- InpLockTradingOnBreach: lock the rest of the server day when the limit is reached. Default on.
- InpCancelPendingOrders: delete pending buy and sell limit and stop orders on a breach. Default on.
- InpSendPushOnBreach: send a push notification to the MetaTrader mobile app on a breach. Default on.
- InpPlaySoundOnBreach: play an audible alarm on a breach and on the warning level. Default on.
- InpPanelX, InpPanelY: the panel position in pixels.
- InpUseProfitTargetLock: lock the day when the daily profit target is reached. Off by default.
- InpDailyProfitTargetPct: the daily profit target, as a percentage of the day's starting balance. Default 5.
The profit target is optional and off by default, so the shipped path is the loss path alone. It is measured on floating equity against the day's starting balance, the same measure the daily loss limit uses, and it runs the same breach actions: positions are closed when auto-close on breach is on, pending orders are deleted when pending cancellation is on, and the day is locked when the day lock is on. The loss breach and the profit target cannot fire in the same tick, because a gain against the day's base and a loss against it cannot both be true. With the day lock on, the breach checks stop until the server date changes or the tool is reloaded, and a position opened in the meantime is closed again on the next tick when auto-close is on. With the day lock off, the loss check keeps running while the drawdown is still at or beyond your limit, so a position opened after the breach is closed again when auto-close is on.
If you have used it, I would welcome a short review of what worked and what did not.
