QuantForge
en

How to add a daily drawdown limit to any EA

Add a daily loss limit, risk-based lot sizing and a lot cap to a MetaTrader EA so it respects prop-firm challenge rules. Built from blocks, tested on your own data.

Start freeRead the docsFree plan, no card needed.

Updated 5 November 2026

Most prop-firm challenges fail on one rule: the maximum daily loss. An EA that doesn’t know about it will keep trading on a bad day. This guide adds a daily limit, risk-based position sizing and a lot cap to any strategy in QuantForge.

1. Pick your limits, with a margin

If your firm allows a 5% daily loss, set the EA to stop at 4%. Firms measure the day in their own time zone and may count floating losses, commission and swap. A margin protects you from those differences. Do the same for any maximum lot size.

2. Put the guards in front of the entries

On the onTick canvas, before your entry conditions:

  1. Daily Drawdown Guard at 4%, with close all positions on. Its YES output continues to your strategy; at the limit, it closes everything and takes NO until the next server day, so no new order is sent.
  2. Max open lots set to your firm’s cap (or lower). It passes only while the EA’s open volume is below the cap.
  3. Optionally, Daily equity target: stop for the day once equity is up 2%, if you prefer to protect good days.

Then your existing entry logic follows the YES outputs as before.

3. Size every trade from risk

Use Risk % Lot Calculator before the order blocks, or set the order block’s lot to risk %: the lot comes from a percentage of equity and the trade’s stop loss. With a 4% daily limit, 0.5% to 1% risk per trade leaves room for several losers in a row.

4. Control when it trades

  • Time / Session Filter for the hours your strategy was designed for.
  • Weekday filter and a Close Trades after a Friday Time window, if your firm doesn’t allow weekend holding.
  • Trades today to cap the number of trades per day.

5. Test the guard, not just the strategy

Backtest with your challenge’s deposit and leverage on at least a year of M1 data. In the trade list, find the worst days and check that trading stopped where it should. The equity curve shows the drawdown from the peak; compare it with the firm’s overall drawdown rule as well. On Studio, run a Monte Carlo analysis: the 95th percentile drawdown is a better guide than the single drawdown of your backtest.

The prop-firm EA page lists every block that maps to a challenge rule. QuantForge isn’t affiliated with any prop firm: check what your firm allows, including EAs, before you run one on a challenge account.

Frequently asked questions

How do prop firms measure daily drawdown?

It varies. Many compare equity with the balance (or the higher of balance and equity) at the start of the day, often at midnight in a time zone of their choice. Read your firm's exact rule and set the EA's limit below theirs.

Should the EA close trades when the limit is hit?

If the firm counts floating losses, yes: closing at your limit stops a bad day from becoming a breached account. The Daily Drawdown Guard can close everything at the limit and then blocks new trades until the next server day.

Does the guard protect against gaps?

Not fully. If price gaps over the stop or the limit, for example over a weekend, the loss can be larger than planned. Avoid holding through weekends and major news if your firm's limits are tight.

Build your first EA today

The free plan includes three projects, backtests on H1 to D1 over a year, MQL4/MQL5 export and the converter.

Start free

Keep exploring