MT5 Expert Advisors for prop firm challenges: rules your EA must follow

By Awais Chaudhry, 27 November 2026

Most traders who fail a prop firm challenge with an Expert Advisor do not fail because the strategy stopped working. They fail because the EA broke a rule it was never told about: it measured the daily loss from the wrong number, kept a trade open over a news release, or opened one lot too many on a Friday afternoon. A funded account is not just a trading account with more money in it. It is an account with a rulebook, and the rulebook ends the challenge the moment a limit is touched, even for a second.

This guide explains the rules that matter to an MT5 Expert Advisor, how each one should be coded, and what to confirm with your firm before anyone writes a line of MQL5. One point first: an EA automates the strategy you define. It cannot guarantee that you pass a challenge or make money, and leveraged forex and CFD trading carries a high risk of loss. Every EA must also follow the terms of the firm and broker it trades on and the laws where you live.

Why prop firm rules change how an EA is built

On a personal account, a bad day costs money. On a challenge, a bad minute can cost the whole account. That changes the design. A normal EA asks "should I open a trade?" A prop firm EA has to ask a second question first: "am I allowed to, and what happens to my limits if this trade goes wrong?"

In practice this means the EA needs a rule guard: a separate block of code that runs on every tick, tracks balance and equity, and can block new entries or close positions no matter what the strategy wants. The strategy proposes, the guard decides. Keeping the two apart also makes testing easier, because you can check the guard on its own.

The rules your EA must follow

Names and numbers vary between firms and change over time, so always read your firm's current terms. These are the rule types we see most often, and how an EA should handle each one.

1. Daily loss limit

This is the rule that ends the most challenges. The firm sets a maximum loss for one trading day, and the key details are hidden in how it is measured:

  • Starting point. Is the day measured from the starting balance, or from the higher of balance and equity at the daily reset? If you start the day with an open trade in profit, these give different numbers.
  • Floating losses. Most firms count open (floating) losses, not just closed trades. An EA that only checks closed profit will breach the limit while a trade is still open.
  • Reset time. The day usually resets at a set server time, which may not match your local midnight or the broker's chart time.

The EA should record the reference value at the reset, check equity on every tick, stop opening trades at a buffer before the limit (for example 80% of it), and close positions at a second, tighter threshold set by you. As an illustration only: if a firm allowed a 5% daily loss on a $100,000 account, the EA might stop new trades at a $4,000 loss and close everything at $4,500, leaving room for slippage.

2. Maximum drawdown

The overall loss limit comes in two main forms, and the EA must know which one applies:

  • Static drawdown is a fixed floor based on the starting balance. It never moves.
  • Trailing drawdown follows the highest balance or equity the account has reached, so the floor rises as you make profit. Some versions stop trailing once the floor reaches the starting balance.

A trailing floor needs the EA to remember the high-water mark across restarts. If the EA forgets it after a VPS reboot, its idea of the floor is wrong. We store these values in a file or global variables, not only in memory.

3. Lot size, exposure and open-trade caps

Some firms cap the lot size or total exposure, and the strategy's own sizing should be limited too. The EA should calculate lots from the distance to the stop loss and a risk percentage, round them to the symbol's lot step, and refuse any order above your cap. It should also limit the number of open trades and the total risk per symbol, so three correlated trades on EURUSD, GBPUSD and the dollar index do not add up to one large bet.

4. News trading windows

Many funded accounts restrict opening or closing trades in a window around high-impact news. Firms define which events count and how long the window lasts, and some apply the rule only to funded accounts, not to the challenge. An EA can read a news schedule, from the MT5 economic calendar or a list you maintain, and pause entries around those times. It can also close or protect positions before the event if your firm requires that.

5. Weekend and overnight holding

Some account types do not allow trades to be held over the weekend. An EA can close positions at a set time on Friday in server time, and avoid new entries in the last hours of the week. Gaps on Monday open are one of the risks that a stop loss does not protect against, so this rule is worth having even when the firm does not require it.

6. Minimum trading days and inactivity

Firms often require a minimum number of trading days, or close an account after a period with no trades. These are easier to handle by hand than by code, but the EA can report the count on its chart panel so you always know where you stand.

7. Consistency rules

Some firms limit how much of the total profit can come from a single day. Forcing this in code usually hurts the strategy, because the EA would have to stop trading on good days. A better approach is for the EA to show the share of profit from your best day, and let you decide.

8. Prohibited strategies

Firms commonly ban latency arbitrage, tick scalping that exploits feed delays, copying trades across accounts of different people, hedging between accounts and some uses of third-party EAs. Read this section of the terms carefully. A reputable developer will not build an EA designed to get around these rules, and we do not.

What to confirm with your firm before coding

  1. Is the daily loss measured from balance, equity, or the higher of the two, and at what server time does it reset?
  2. Is the maximum drawdown static or trailing, and does trailing stop at some point?
  3. Are EAs allowed on the challenge, the funded account, or both? Are third-party or purchased EAs treated differently?
  4. Which news events are restricted, and for how many minutes before and after?
  5. Are weekend holding, hedging or a maximum lot size restricted on your account type?

Write the answers down and give them to your developer with the strategy. Every limit should then become an input in the EA's settings, not a number hard-coded for one firm, so you can switch firms or account sizes without new code.

Testing a prop firm EA before the challenge

  • Strategy Tester with real ticks. Run MT5's Strategy Tester on real tick data where your broker provides it, with realistic spread and commission. Check the tester's equity curve against your daily loss and drawdown limits, not just the final profit.
  • Test the guard on its own. Force losing scenarios, such as a large adverse move with several trades open, and confirm the EA stops and closes at the right levels.
  • Out-of-sample data. Keep a period of history the strategy was not tuned on. A strategy that only works on the data it was optimised on is curve-fitted.
  • Demo forward test. Run the EA on a demo account for a few weeks and compare its trades with the tester. Big differences usually mean slippage, spread or execution assumptions are wrong.
  • Restart test. Restart MT5 and the VPS while trades are open, and check that the EA picks up its positions and remembers its daily and maximum drawdown values.

Running the EA on a challenge account

An EA only works while MT5 is running, so use a Windows VPS or the MetaQuotes VPS close to your broker's server. Set the guards tighter than the firm's limits for the first days, check the Experts and Journal tabs daily, and turn on Telegram alerts for entries, exits, errors and limit warnings. If the firm runs its challenge on a platform other than MT5, the same rules apply, but the code will be different.

Common mistakes that fail challenges

  • Checking closed profit instead of equity, so floating losses breach the daily limit.
  • Using the wrong reset time for the trading day.
  • Forgetting the trailing drawdown high-water mark after a restart.
  • Martingale or grid logic that adds to losing positions with no hard loss cap.
  • Stops placed too close to the limit, so one slipped order goes over it.
  • Running a purchased EA without checking that the firm allows it or that others are not trading the same signals.

What a prop firm EA costs

At $50 per hour, an EA from clear rules on one symbol usually takes 30 to 60 hours ($1,500 to $3,000). Adding prop firm guards, a settings panel and Telegram alerts brings it to about 50 to 80 hours ($2,500 to $4,000). Adding guards to an EA you already have, or converting a TradingView or MT4 strategy, is often 15 to 40 hours. For a quick range from your own feature list, use our bot cost calculator, and see how much a trading bot costs to build in 2026 for the wider picture.

How we build prop firm EAs

We have built software from Lahore, Pakistan since 2014. For MT5 work we write your rules back as a precise spec, code the EA in MQL5 with the guard separated from the strategy, share Strategy Tester reports, forward test on demo, and hand over the .mq5 source. We do not sell strategies or signals and do not promise challenge passes. See our MT5 Expert Advisor development service, trading bot development for TradingView and other platforms, crypto trading bots, and Telegram and Discord bots for alerts and remote control. If you trade crypto rather than forex, our arbitrage bot and bot development pages cover other bot types, and business automation, web scraping and AI chatbot development cover the non-trading side.

Questions traders ask

Can an EA guarantee I pass a prop firm challenge?

No. Nobody can honestly guarantee a pass or profits. An EA automates the strategy you define and can stop trading before it breaks the daily loss, drawdown or lot rules you configure. Whether it reaches the profit target depends on the strategy and the market, and trading carries a high risk of loss.

Do prop firms allow Expert Advisors?

Many do, but rules differ by firm and account type and change over time. Some ban high-frequency trading, latency arbitrage, copying trades across accounts or third-party EAs. Check your firm's current terms before you start, and do not use an EA designed to get around them.

Can you add prop firm rules to my existing EA?

Usually yes, if you have the .mq5 source code. We add a separate rule guard for daily loss, maximum drawdown, lot caps, news and weekend rules, with every limit as an input. This typically takes 15 to 40 hours at $50 per hour, depending on how the EA is written.

Get your EA built or checked

Send us your strategy rules, your firm's limits and your broker. We reply within one business day with questions or a milestone estimate at $50 per hour. Start a project, or hire us on Freelancer, where we are a Preferred Freelancer with a 4.9 average from 356 reviews, and you pay 0% commission through this link.