Prop firm EA rules: daily loss, max drawdown and news filters done right

One missed news filter. One breached account. One lost challenge fee.

Prop firms write their risk rules in a sentence: "Maximum daily loss 5%." "No trading around high-impact news." In code, each sentence hides several decisions. Guess one wrong and the EA can follow its own rule perfectly and still breach yours.

This article walks through those decisions for daily loss, maximum drawdown and news, with real log lines from the acceptance test of our sample EA, so you can see each rule fire.

One thing first. Firms change their rules, often per account type, so we never work from memory: you confirm your firm's current rules, they go into a numbered spec, and the EA enforces those numbers.

Daily loss: four questions before any code

1. Percent of what?

"Daily loss 5%" needs a reference value. Common definitions are:

These give different lines. If you start the day with an open position in profit, a balance-based reference ignores that profit and an equity-based one includes it. A fixed amount from the initial account size does not grow or shrink as your balance changes.

Our sample spec makes the reference selectable (balance, equity, or the higher of both) and logs it every server day. In our test run, with the limit deliberately set to 0.5% so it would trigger, that day's reference was 10,000.74 and the limit 9,950.74 (full log below). The reference is not the 10,000 deposit because it is recorded fresh each day from the balance and equity at that moment. If your firm uses a different definition, that is a different formula, and it goes into your spec.

2. Equity or closed balance?

A guard that only checks closed balance fires after the losses are realised. By then a floating loss may already have crossed the firm's line. Firms that measure daily loss on equity count open positions, so the EA has to watch equity on every tick, not just after a trade closes.

3. When does the day reset?

The EA's "day" must match the firm's day. MT5 broker servers often run at GMT+2 or GMT+3 with daylight saving changes; your firm may reset its daily limit at midnight in its own time zone. If those differ by an hour, the EA records its reference an hour early or late, and on a volatile evening that hour can matter.

Our sample EA uses the broker's server day and records the new reference on the first tick of each day. If your firm resets at a different time, the reset time becomes an input in your spec.

4. What happens at the line?

"Stop trading" can mean several things. Our sample spec says: close all of the EA's positions on that tick, block new entries until the next server day, and log every blocked signal. From the test run:

[P1] LOCK daily loss hit: equity=9945.61 reference=10000.74 limit=9950.74
[P1] closed #4 (daily loss)
[P1] BUY signal blocked - daily loss lock active
[P1] new day ... daily lock released

The limit is a trigger, not a guaranteed exit price. The lock fired at equity 9,945.61, which is 5.13 below the 9,950.74 limit, because the EA reacts on the first tick at or below the line and price had already moved past it. Live, slippage on the closing orders adds to that. So set the EA's limit with a buffer inside the firm's, and make the buffer a number you choose and sign.

Whose positions? Our sample closes the EA's own positions (identified by its magic number). Firms measure the whole account. If you also trade manually or run a second EA on the same account, decide in the spec whether the guard closes only its own trades or everything on the account.

Maximum drawdown: static or trailing

Static. The floor is fixed, usually a percentage below the initial account size, and never moves. Our sample EA's P2 rule is static: the reference is the initial balance input, or the account balance when the EA first starts if the input is zero.

Trailing. The floor follows the account's high-water mark. Intraday trailing versions track the peak in real time, including unrealised profit on open positions. End-of-day versions only move the floor based on the closing balance. Trailing drawdown is common at futures prop firms and some forex firms.

A trailing rule also needs the EA to store the high-water mark across restarts. Held in a normal variable, the peak resets on restart and the EA's floor drops below the firm's.

From our test run, with max drawdown set to 1.5% so it would trigger:

[P2] LOCK max drawdown hit: equity=9848.75 reference=10000.00 limit=9850.00
[P2] closed #6

After that line the log shows zero new entries for the rest of the test, only [P2] ... blocked lines. In our spec a max-drawdown lock stays on until the trader deliberately resets it with an input. Again, the trigger came 1.25 below the line, for the same tick-by-tick reason as above.

News filters: where do the times come from?

A news rule raises three questions.

Which events and which window? News rules typically name an impact level and a number of minutes before and after the release. The window, the currencies that count and the impact level all go into the spec.

What is blocked? New entries only, or also closing and modifying positions? Some firm rules restrict any trade activity inside the window, which means the EA should also hold off on break-even and trailing-stop changes there. That has to be written down.

Where do the times come from? MT5 has a built-in economic calendar with MQL5 functions to read it, but those functions do not return historical data inside the Strategy Tester. A news filter that reads the calendar live cannot be backtested as-is. Our sample EA takes a list of news times as an input, in server time, so the same rule can be tested and recorded:

[P3] BUY signal news pause around 2026.07.02 16:00

Both test times were picked where the strategy produced an entry signal, so the test shows the pause blocking a real trade, not idling in a quiet hour. Live, the times can come from the MT5 calendar or a file; the source goes in the spec.

Restart safety: the test that gets skipped

The formula gets the attention. The restart is what usually goes untested.

If the day's reference, the trade counter or the lock flag live only in memory, any of these resets them: removing and re-attaching the EA, changing the chart timeframe, restarting the terminal, or a VPS reboot. The EA wakes up with a fresh day, no lock, and starts trading again on an account that was locked an hour ago.

Our sample spec stores the daily reference, trade count and locks in terminal global variables, so they survive those events. On start, the EA logs what it restored ([P6] restored ...). Test AT-13 covers this: trigger the daily lock on a demo account, remove the EA, attach it again, change the timeframe, and show that the lock is still active.

It is the one test in our sample that cannot run in the Strategy Tester, so it is done on a live demo chart during the recording and stays marked "not run yet" until then. We would rather publish that than tick a box nobody checked.

How each limit is breach-tested

A limit that never triggers in testing has not been tested. The method in our acceptance checklist:

  1. Shrink the limit so it triggers inside the test period: 0.5% daily loss, 1.5% max drawdown, one trade per day.
  2. Run on real ticks, with all inputs printed to the log at start so the setup is on record.
  3. Show the trigger line, the close lines, the blocked-signal lines and the release line, in that order.
  4. Record it, one video chapter per rule.

Our sample results for the guard rules (EURUSD, 1 July to 1 October 2026, "Every tick based on real ticks"):

Test Rule Setting for the test Result
AT-08 P1 daily loss 0.5% PASS
AT-09 P2 max drawdown 1.5% PASS
AT-10 P3 news pause two times in the period PASS
AT-11 P4 Friday close 20:45 server time PASS
AT-12 P5 max trades per day 1 per day, M15 PASS ([P5] SELL signal limit reached (1/1 today))
AT-13 P6 restart safety live demo chart Not run yet (needs a live chart)

These are code-behaviour tests. They say nothing about profitability.

A spec template for your guard rules

Copy this, fill it from your firm's current rules page, and send it to whoever builds your EA:

P1 Daily loss:     limit ___% | reference: balance / equity / max / fixed from initial
                   reset time ___ (firm time zone ___) | buffer inside firm limit ___
                   on hit: close EA positions / all positions | block until ___
P2 Max drawdown:   limit ___% | static / trailing (intraday / end of day)
                   on hit: close ___ | stays locked until ___
P3 News:           events ___ | window -___ / +___ min | block entries / closes / modifications
                   time source: calendar / file / input list
P4 Weekend:        close at ___ server time on Friday | block until ___
P5 Trades per day: max ___ | max lots ___
P6 Restarts:       all of the above survive re-attach, timeframe change, terminal restart

If you cannot fill a line, that is the line to ask your firm about before any code is written.

What code cannot do

Code can enforce the numbers you sign. It cannot guarantee you pass a challenge or keep a funded account. Gaps, slippage on closing orders, and differences between your terminal's equity and the firm's own calculation can all put the final number past the line. A buffer covers that; a good test shows how close the trigger lands.

Get your prop rules into code, and see them fire

Mudasir, the engineer behind AlgoTailor, has finished 680 jobs on MQL5, rated 4.9 from 620 client reviews (public MQL5 profile). For prop-firm builds, you confirm your firm's current rules, we enforce the numbers in your signed spec, and every limit is breach-tested and shown on video before final payment. You get the full source code on final payment.

Send your rules. We reply within 24 hours, Monday to Saturday (PKT), with questions and a fixed quote. Send your rules on algotailor.com


Trading involves substantial risk. AlgoTailor builds software to the client's specification and does not provide trading or investment advice or guarantee trading results. AlgoTailor is not affiliated with any prop firm.

Related: MT4 & MT5 development · EA works in backtest but not live

Send your rules. Rough notes are fine. We reply within 24 hours, Monday to Saturday (PKT), with questions, a numbered spec and a fixed quote.

Send your rules