Defend Your Trading Account: Introducing Drawdown Manager EA for MT4/MT5! Wave Goodbye to Account Blowouts!
MT4 Version: Drawdown Manager MT4
MT5 Version: Drawdown Manager MT5
Complete User Documentation — MT4 & MT5
1. OVERVIEW
The Drawdown Manager is a safety-first utility that tracks your account equity in real time and automatically intervenes when losses hit predefined thresholds. It uses a high-water mark or trade-history reconstruction method to calculate drawdown, then can close trades, delete pending orders, or even shut down the terminal. This solves the problem of emotional hesitation during a losing streak — you set the rules upfront, and the tool enforces them without second-guessing.
Who Should Use It: Retail forex traders who want a hard stop on losses without having to stare at their screen all day, especially those managing multiple strategies or funded accounts with strict drawdown rules.
Main Benefit: Automatically enforces your risk limits so you never blow past a daily, weekly, or monthly drawdown target due to inattention or market volatility.
2. INPUT PARAMETERS & SETTINGS
This product shares a common set of general input settings with all Utility products in this series. The following sections are covered in the common guide: Position Sizing, Alert Settings (popup, push notification, email), Trade Time Settings (session-based time filters), Trade Days Settings (per-day enable/disable with broker start and end times, covering Monday through Sunday), and Day-wise Time Filter Settings (close trades if outside valid trading time). For full details refer to the Common General Input Settings Guide. The sections below cover only the product-specific inputs unique to this product.
General Settings
These settings define the core behavior of the drawdown monitor — how it calculates losses, which symbols it watches, and whether it accounts for swap costs.
| Setting Name | Type | Default Value | Description | Example |
|---|---|---|---|---|
| Chart lines for virtual SL/TP (never drawn during optimization) | bool | false | When enabled, this draws dashed lines on the chart showing where your hidden stop-loss and take-profit levels sit. Useful for visual confirmation during live trading, but keep it off during optimization to avoid clutter and speed things up. | true — Enable this on your main chart during live trading so you can see the virtual SL/TP lines without them interfering with broker-side orders. |
| Monitor scope | ENUM | CHART_SYMBOL | See options explained below. | See options explained below. |
| Drawdown calculation mode | ENUM | DD_TRADE_HISTORY | See options explained below. | See options explained below. |
| Include Swap charges in Profit | bool | true | When set to true, swap fees (overnight interest) are included in the profit/loss calculation for drawdown. This gives a more accurate picture of your real P&L, especially if you hold positions for days or weeks. | true — Keep this on if you trade pairs with high swap rates like GBP/JPY or hold positions over weekends. Set to false only if you scalp and rarely hold overnight. |
| Enable history for backtests or optimization | bool | false | Turning this on loads historical trade data during backtests so the drawdown calculation can account for past closed trades. Leave it off for faster optimization runs; enable it only when you need a full historical simulation. | true — Enable this for a final validation backtest where you want the drawdown to reflect all closed trades, not just open positions. |
Monitor scope — Options Explained
This setting controls whether the drawdown manager watches only the symbol on the chart it's attached to, or your entire account. Choose based on how many strategies you run simultaneously.
Chart symbol only: The utility only monitors positions and drawdown for the specific symbol on the chart where the EA is attached. Use this when you have separate EAs on different charts and want each to manage its own risk independently.
Whole account (magic/manual filter): The utility watches all open positions across your entire account, filtered by magic number or manual trades. This is the right choice if you want a single drawdown manager to protect your whole portfolio, like a master kill switch for all your strategies.
Drawdown calculation mode — Options Explained
This determines how the tool measures your drawdown — either by reconstructing from trade history or by tracking the peak equity. The choice affects when protective actions trigger.
Reconstructed from closed deals + open P/L: The drawdown is calculated by summing the results of all closed trades plus the current floating P&L of open positions. This gives a cumulative loss figure that resets after profitable trades. It's the standard method for most retail traders and works well for daily or weekly loss limits.
Peak equity high-water mark (prop firm style): The drawdown is measured from the highest equity level ever reached in the account. This is the method used by prop firms for evaluation challenges — it never resets, so even after a recovery, the drawdown from the all-time high persists. Use this if you're trading a funded account or want the strictest possible risk control.
Safeguard Settings
These settings let you define hard limits on losses across different timeframes — hourly, daily, weekly, monthly — plus backtesting-only constraints for evaluating strategy robustness.
| Setting Name | Type | Default Value | Description | Example |
|---|---|---|---|---|
| Enable/Disable Closed Trades in Drawdown Calculation | bool | true | When true, closed trades are included in the drawdown calculation, so losses from earlier in the day or week still count. Set to false if you only want to monitor the current open positions' floating drawdown. | false — Use this if you scalp and close many trades quickly; you only care about the drawdown on open positions, not the cumulative daily loss. |
| Max Loss from initial balance [0: disable] | double | 0.0 | Sets a maximum percentage loss from your starting account balance. Once hit, the EA triggers protective actions. This is your ultimate safety net — it prevents your account from ever dropping below a certain level, regardless of timeframes. | 20 — Set to 20% if you want to stop all trading after losing 20% of your initial deposit. This is a common rule for funded account challenges. |
| Minimum Profit Percent [backtesting only] [0: disable] | double | 0 | This is a backtesting filter — if the total profit percentage over the test period is below this value, the run is considered a failure. Use it to automatically discard strategies that don't meet your minimum profitability threshold during optimization. | 5 — Set to 5% during optimization to only keep parameter sets that returned at least 5% profit over the backtest period. |
| Minimum Trades [backtesting only] [0: disable] | double | 0 | Another backtesting filter — it requires a minimum number of trades to be executed during the test. This prevents you from accepting a strategy that got lucky with just one or two trades. Helps ensure statistical significance in your optimization results. | 50 — Set to 50 to discard any optimization run that didn't execute at least 50 trades, ensuring your results aren't based on a tiny sample. |
| Max inactive days [backtesting only] [0: disable] | int | 0 | Sets the maximum number of consecutive days without any trade activity during a backtest. If the strategy goes silent for longer than this, the run is flagged. Useful for avoiding strategies that only trade in specific market conditions and then sit idle for weeks. | 10 — Set to 10 to reject any backtest where the strategy didn't trade for 10 consecutive days, which might indicate it's too dependent on rare market events. |
| Hourly Drawdown % [0: disable] | double | 0 | Limits the percentage loss allowed within a single hour. If the account drops by this much from the start-of-hour equity, protective actions fire. Use this to catch fast-moving losses during high-impact news events or volatile sessions. | 3 — Set to 3% to stop trading if you lose 3% of your account in one hour, which is a reasonable limit for news trading. |
| Daily Drawdown Amount [0: disable] | double | 0 | Sets a fixed monetary loss limit for a single day. Once the daily loss in account currency reaches this amount, the EA takes action. This is the most straightforward way to enforce a daily loss limit — no percentage math, just a hard number. |
3. HOW IT WORKS
Core Calculation & Logic
The Drawdown Manager continuously tracks your account's equity curve, comparing the current equity against the highest equity point recorded since the EA started running. It calculates drawdown as both a fixed monetary amount and a percentage of that peak equity. The tool also monitors daily, weekly, and monthly drawdown percentages independently — so you can set tighter intraday limits while allowing more room over longer periods. If you enable swap and commission checking, those costs get factored into the loss calculation too, giving you a truer picture of your actual risk exposure.
Mathematically, the EA computes drawdown as (Peak Equity - Current Equity) / Peak Equity * 100 for percentage mode, and as a simple subtraction for the fixed loss amount. It resets the peak equity reference when a new high is reached, which means it's measuring peak-to-trough decline — the standard way professional risk managers assess drawdown. This approach catches both gradual equity erosion and sudden drops, making it suitable for any trading style from scalping to swing trading.
How It Operates
The EA runs on every tick (or every bar period if you choose that mode) and checks your current equity against all enabled thresholds. It evaluates four separate drawdown limits simultaneously: fixed loss amount, loss percentage, daily drawdown percent, weekly drawdown percent, and monthly drawdown percent. If any of these thresholds is breached, the EA triggers the configured protective action — which could be closing all open trades, closing the chart, or even shutting down the entire terminal. You'll find these action settings in the "Actions on Breach" section of the inputs.
Before taking action, the EA also checks whether closed trades should be included in the drawdown calculation. If you set Enable/Disable Closed Trades in Drawdown Calculation to false, it only looks at open positions — useful if you're running a strategy that books small frequent profits but occasionally holds losing trades. The trade frequency limits (max trades per week and per month) act as additional safeguards, preventing the EA from opening new positions once you've hit your predefined trade count ceiling. This layered approach means you're protected not just by drawdown limits but also by overtrading controls.
Key Features in Detail
What sets this utility apart is its multi-timeframe drawdown monitoring — you can set separate daily, weekly, and monthly limits that work independently, so a bad Monday won't necessarily kill your whole week if you recover. The hidden stop-loss and take-profit feature lets you set virtual SL/TP levels that the broker never sees, which can help avoid stop-hunting by market makers. You also get the option to include swap and commission costs in your drawdown calculations, something most basic drawdown tools ignore. And the scan mode choice — every tick versus period-wise — lets you balance CPU usage against responsiveness, which matters if you're running multiple instances on a VPS.
Step-by-Step Workflow
Step 1: Attach the EA to a chart Drag Drawdown Manager onto any chart in MT4 or MT5. It doesn't need to be on a specific pair — it monitors the entire account, not just one symbol. Make sure you've set the Magic Number if you want it to only manage trades opened by this EA instance.
Step 2: Set your loss thresholds In the General Settings section, enter your Loss Amount (e.g., 100 for $100) or Loss Percent (e.g., 5 for 5%). Leave the other at 0 to disable it. Most traders I know use percentage-based limits because they scale with account size automatically.
Step 3: Configure time-based drawdown limits Go to Safeguard Settings and set Daily Drawdown Percent (try 2%), Weekly Drawdown Percent (try 5%), and Monthly Drawdown Percent (try 10%). These act as early warning layers — you'll hit the daily limit long before the monthly one kicks in.
Step 4: Choose your breach action In the Actions on Breach section (covered in Part 3), decide what happens when a limit is hit. For a conservative setup, select "Close All Trades" so you can review the market before re-entering. For aggressive protection, "Close Terminal" ensures no further trading happens until you manually restart.
Step 5: Set trade frequency caps Enter Maximum Trades Per Week (e.g., 10) and Maximum Trades Per Month (e.g., 40) to prevent overtrading. These work independently from drawdown limits — you'll stop opening new trades once you hit the count, even if your drawdown is fine.
Step 6: Enable logging if needed Set Capture Logs to true to record all actions in the Experts tab. This is invaluable for backtesting and troubleshooting — you can see exactly when and why the EA triggered.
Step 7: Test on a demo account first Run the EA on a demo for at least a week with realistic market conditions. Watch how it responds to drawdown events and adjust your thresholds accordingly. I've seen traders set limits too tight (like 1% daily) and get stopped out by normal equity fluctuations — give yourself enough breathing room.
4. KEY FEATURES & CAPABILITIES
The Drawdown Manager packs several advanced risk management features into a single utility, giving you granular control over how your account is protected.
| Feature | Description |
|---|---|
| Multi-Timeframe Drawdown Limits | Set separate daily, weekly, and monthly drawdown percentages that work independently. A bad day won't necessarily trigger your weekly limit if you recover later in the week, giving you more flexibility than a single hard cap. |
| Hidden Stop-Loss & Take-Profit | Place virtual SL/TP levels that the broker never sees on their servers. This prevents stop-hunting and keeps your exit strategy private. The chart lines for these levels are optional and never drawn during optimization to avoid clutter. |
| Swap & Commission Awareness | When enabled, the EA factors swap fees and commissions into the loss calculation. This is critical for traders holding positions overnight or trading instruments with high commission costs — otherwise your drawdown readings will be artificially low. |
| Trade Frequency Controls | Cap the number of trades per week and per month independently. This prevents overtrading during volatile periods and enforces discipline — you can't revenge trade your way back from a drawdown if you've hit your trade limit. |
| Flexible Scan Modes | Choose between checking conditions on every tick (maximum responsiveness) or once per bar period (lower CPU usage). The period-wise mode is ideal for running multiple EA instances on a VPS without overloading the system. |
Quick Start Guide
Follow these steps to get started in under 5 minutes:
- Download and install: Purchase the product from the MQL5 Market, download it, and install it via the Navigator panel in MT4 or MT5. Drag it onto any chart — it doesn't matter which symbol.
- Set your loss limit: In the General Settings section, enter a Loss Percent of 5 (or whatever percentage you're comfortable with). Leave Loss Amount at 0 to disable it — percentage-based limits are simpler for most traders.
- Configure daily and weekly limits: In Safeguard Settings, set Daily Drawdown Percent to 2 and Weekly Drawdown Percent to 5. This gives you a two-tier safety net — you'll hit the daily limit first during a bad day, but still have room if the week recovers.
- Choose your breach action: Find the "Actions on Breach" section (detailed in Part 3) and select "Close All Trades" as your primary action. This stops further losses while keeping the terminal running so you can analyze what happened.
- Set trade frequency caps: Enter Maximum Trades Per Week as 10 and Maximum Trades Per Month as 40. These prevent overtrading and give you a hard stop on how many positions you can open.
- Enable logging: Set Capture Logs to true. This writes all actions to the Experts tab so you can review what triggered and when — essential for tuning your settings later.
- Test on demo: Run the EA on a demo account for at least 3-5 trading days. Watch the Experts tab for log entries and verify that drawdown limits trigger correctly. Adjust percentages if you find yourself getting stopped out too often during normal market noise.
Installation Guide for MQL Products | Updating Purchased MQL Products on MT4/MT5 | General Troubleshooting Guide | Indicator Settings / Guide
Check all my products: https://www.mql5.com/en/users/biswait50/seller
Contact me for support: https://www.mql5.com/en/users/biswait50


