Fresh MQL5 code release – perfect for enhancing your MT4/MT5 strategies.
Prop Firm Drawdown Monitor - Real-Time Protection for Funded Accounts
This utility monitors your drawdown in real time and automatically closes all positions before you breach your prop firm's limits.
WHY
82% of funded account terminations are caused by rule violations, not bad trading decisions. Most traders track drawdown manually or rely on the prop firm's dashboard, which often updates with a delay. This tool solves that by running directly inside MetaTrader 5 with sub-second monitoring.
FEATURES
- Daily Drawdown Tracking: Configurable daily loss limit with timezone-aware reset logic. Supports any reset hour and timezone offset (FTMO uses midnight CET, others use 5 PM EST, etc.)
- Total Drawdown: Both STATIC mode (measured from initial balance, floor never moves) and TRAILING mode (measured from highest equity peak, floor follows profits up)
- Auto-Close on Breach: When drawdown reaches the limit minus a configurable safety buffer, all positions are closed and all pending orders are cancelled immediately. Uses generous slippage (50 points) to guarantee execution.
- Trade Blocking: After a breach, OnTradeTransaction catches any new positions opened by other EAs or manual trading and closes them within milliseconds. Also sets a GlobalVariable flag that other EAs can check before opening trades.
- On-Chart Dashboard: Live display showing daily DD %, total DD %, current equity, and status (SAFE / WARNING / BREACH) with color coding.
- State Persistence: All critical values (daily reference balance, high equity watermark, breach state) are saved via GlobalVariables and survive EA/terminal restarts.
CONFIGURATION
Account Size: Your funded account amount (used as denominator for DD calculation — NOT current balance)
Daily DD Limit: Percentage (e.g. 5.0 for FTMO)
Total DD Limit: Percentage (e.g. 10.0 for FTMO)
Trailing Mode: false for static, true for trailing total DD
Reset Hour: Hour of daily reset in reset timezone
Reset TZ Offset: UTC offset of your prop firm's reset timezone
Safety Buffer: Percentage margin to close BEFORE the actual limit
Warning Threshold: Alert when this % of the limit is reached
HOW IT WORKS
1. Attach to any chart. Configure your prop firm's rules.
2. The timer runs every 500ms, comparing current equity against reference values.
3. At daily reset time (timezone-aware), the daily reference balance resets to the higher of balance or equity.
4. If daily or total drawdown reaches (limit - buffer), emergency close triggers.
5. After breach, OnTradeTransaction blocks any new trade entries.
6. Dashboard shows real-time status on chart.
IMPORTANT NOTES
- Account Size input should be your INITIAL funded amount, not current balance. DD percentages are always calculated from initial size.
- The safety buffer (default 0.5%) means positions close slightly before the actual limit, giving execution room for slippage.
- This is a monitoring utility, not a trading EA. It does not open any trades.
- For timezone: FTMO uses UTC+1 (CET) or UTC+2 (CEST during summer). Check your prop firm's rules.
- State survives MT5 restarts via GlobalVariables. A full terminal reinstall will reset state.
FULL VERSION
For additional features including news event filter, prop firm presets (FTMO, The5ers, FundedNext, E8, etc.), session time controls, risk-per-trade enforcement, and CSV logging, see Prop Firm Shield Pro on the MQL5 Market:
https://www.mql5.com/en/market/product/165194
Free Market version (same core as this Code Base entry but packaged as compiled utility):
Grid trading done right – try the robust Grid Expert Advisor for controlled risk. Details here.
Level up your trading with professional RobotFX expert advisors and indicators. Visit www.robotfx.org for proven MT4/MT5 tools.
69430Best MetaTrader Indicators + Profitable Expert Advisors