Prop Firm DrawDown Guard EA
- Utilità
- Branko Balog
- Versione: 1.0
- Attivazioni: 5
Prop Firm Drawdown Guard EA – Documentation
Version: 1.00
Platform: MetaTrader 4 (MT4)
Author: Branko Balog
Website: https://www.mql5.com
🛡️ Purpose
This Expert Advisor (EA) is designed to enforce drawdown limits required by prop trading firms. It helps traders stay compliant with daily and total equity loss rules by automatically:
- Monitoring account equity in real time
- Closing all open trades when limits are exceeded
- Blocking all further trading activity for the rest of the day
- Optionally sending alerts/notifications
⚙️ Inputs
Parameter | Type | Description
------------------------------|---------|---------------------------------------------------------------
MaxDailyDrawdownPercent | double | Maximum allowed daily drawdown in percentage of the day's starting equity.
MaxTotalDrawdownPercent | double | Maximum allowed total drawdown in percentage of initial account balance.
BlockTradingAfterDrawdown | bool | If true, blocks all new trades for the rest of the day after breach.
EnableAlerts | bool | Enables in-terminal alerts when drawdown is breached.
EnableEmail | bool | Sends email notification (requires proper setup in terminal).
EnablePush | bool | Sends mobile push notification (requires proper setup in terminal).
EnableLog | bool | Logs drawdown events in the Experts tab.
⏱️ How It Works
- At the start of each new day, the EA captures the account's current equity as the baseline.
- It continuously compares current equity to:
- The day-start equity → for daily drawdown
- The initial balance → for total drawdown
- If either threshold is breached:
- All open trades are closed immediately
- All pending orders are deleted
- No new trades are allowed for the rest of the day
🧠 Special Logic
- New trade attempts while in "blocked mode" will be automatically cancelled.
- Notifications (alerts/email/push/log) are triggered once per breach.
- Resets daily logic at the start of each new day (based on server time and D1 candle).
✅ Compatible With
- All brokers that support MT4
- All account types
- All symbols and timeframes
