Funded accounts on Gold (XAUUSD) and forex are lost on one bad day more often than on a bad month. This utility EA watches the account equity every second, compares it with the equity at the start of the trading day and, when the day loss reaches your limit, 4 percent by default, it closes every position and deletes the pending orders.
After that the day stays locked. Any new position that appears, from you or from another EA, is closed right away until the next day start, 00:00 server time by default. You can also lock the day on a profit target, and set an overall loss from the starting balance that keeps the account locked until you remove the EA.
It never opens trades. A market close can fill worse than the limit on a fast move or a gap, so set it a little inside the real rule of your prop firm.

Attach it to one chart, any symbol and any timeframe. It works on every symbol of the account, not only the chart symbol, and runs on a 1 second timer so it reacts even when the chart symbol is quiet. AutoTrading must be on so it can close positions. The day start equity is taken when the day begins or when you attach it, whichever comes later, so attach it before you start trading. If the terminal is closed, nothing is watched. Push notifications need your MetaQuotes ID in the terminal options.
Test it in the strategy tester next to your own EA on XAUUSD, EURUSD, GBPUSD, US30 or NAS100, with the money mode, to see where the lock would have stopped a bad day. XP_Guard holds every check, so a weekly limit, a maximum number of trades per day or a news pause go there. XP_CloseAll and XP_DeletePending are ready to copy into any EA that needs an emergency exit.
Open source. Use it as it is, adapt it, build your own version on top of it. New versions and new tools are announced first on my MQL5 channel: https://www.mql5.com/en/channels/xander. Questions, suggestions and your own backtests are welcome in the Xander Lab group: https://www.mql5.com/en/messages/02eec85e4364dd01. More tools on my profile: https://www.mql5.com/en/users/09151993a. Provided as is, use at your own risk.
Related: Risk Lot Size Calculator Panel, Trailing Stop Breakeven Manager, Partial Close Multi TP Manager, Opening Range Breakout EA Gold.
v1.0 (2026-11-20): initial release.
Premium Discount OTE Zones
Premium and discount zones for MT5 on Gold (XAUUSD), forex and indices: dealing range from confirmed swings, equilibrium 50 percent, 25 and 75 percent lines and the OTE band of the last leg. Open source code.
Opening Range Breakout EA Gold
Opening range breakout EA for MT5 on Gold (XAUUSD), forex and indices: trades the first candle that closes outside the opening range, stop at the range, target in multiples of the stop, lot by risk, end of day close. Open source code.
PDH PDL Sweep Levels
Previous day high and low indicator for MT5 on Gold (XAUUSD), forex and indices: PDH, PDL, previous week high and low, day and week open, and an arrow when a closed candle sweeps a level and closes back inside. Open source code.
News Straddle EA Economic Calendar
News trading EA for Gold (XAUUSD) and forex: places a Buy Stop and a Sell Stop seconds before each release of the MT5 economic calendar, one cancels the other, stop loss, take profit and trailing in points. Open source code.