--- title: "How To Backtest An EA In MT5: Step-By-Step Guide" description: "How to backtest an EA in MT5 with the Strategy Tester: modelling modes, a real XAUUSD report explained, plus overfitting and forward test checks." url: https://backcomtrader.vn/en/how-to-backtest-an-ea-in-mt5 lang: en type: article published: 2026-11-10T00:00:00+00:00 updated: 2026-11-18T17:28:29+00:00 author: Datji alternate_vi: https://backcomtrader.vn/vi/backtest-la-gi-backtest-ea-mt5 publisher: BackComTrader --- [Home](https://backcomtrader.vn/en) › [BackComTrader Blog](https://backcomtrader.vn/en/blog) › [Guides](https://backcomtrader.vn/en/blog/guides) › [How To Backtest An EA In MT5: Strategy Tester Guide And Report Reading](https://backcomtrader.vn/en/how-to-backtest-an-ea-in-mt5) # How To Backtest An EA In MT5: Step-By-Step Guide > How to backtest an EA in MT5 with the Strategy Tester: modelling modes, a real XAUUSD report explained, plus overfitting and forward test checks. Summary Backtest an EA in MT5 by opening the Strategy Tester from the Navigator, setting the EA, symbol, timeframe, dates and a modelling mode that suits the robot, then reading the report beyond the profit line. Passing is necessary but never sufficient, so follow with a forward test on unseen data and a demo to catch overfitting. ![How to backtest an EA in MT5: glass time-reel unwinding backwards beside a reverse-spinning clock, a metaphor for testing a strategy on past data](https://backcomtrader.vn/assets/img/posts/media/2026/11/how-to-backtest-ea-mt5-thumbnail.webp) An EA can draw a smooth, rising equity curve on historical data and still lose money in its first week on a live account. The usual cause is not the robot itself but how it was tested: the wrong modelling mode, too little data, or a single profit number taken at face value. This guide covers **how to backtest an EA in MT5** from concept to practice. You will see how the **MT5 Strategy Tester** works, which modelling mode fits which robot, how to read a real report from a gold run, and when a pretty result is just **overfitting in backtesting**. In this article, BackComTrader walks through the concept, the setup, the modelling modes, the report, forward testing and the most common mistakes before a robot moves to a demo account. ## What Is Backtesting? Testing A Strategy On Past Data ![What is backtesting and how it differs from forward testing and demo: a rewinding hourglass, a telescope and a tablet for three ways to test a strategy](https://backcomtrader.vn/assets/img/posts/media/2026/11/what-is-backtesting-vs-forward-test-vs-demo.webp) *What Is Backtesting? Testing A Strategy On Past Data* **Backtesting** means running a trading strategy on price data that has already happened, to see how the rules would have performed at the time. The strategy can be a hand-written rule set or an EA, an automated robot that follows a fixed algorithm. The key point is that a backtest does not predict the future. It answers a narrower question: over the chosen history, with the assumed spread, delay and starting capital, does this rule set behave the way its author claims? Traders use backtesting for three jobs: - Filtering out ideas that lose even under ideal conditions. - Measuring the maximum drawdown before real money is at stake. - Checking that an EA does what its description says. An EA that fails a backtest has no reason to run live. Passing is only a necessary condition, never a sufficient one. If you are new to robots, start with [what a Forex Expert Advisor is](https://backcomtrader.vn/en/what-is-a-forex-expert-advisor). ### Backtest, Forward Test And Demo: What Each One Answers These three steps are often lumped together, yet each answers a different question: 1. **Backtest:** runs on past data in minutes and asks whether the idea is logical. 2. **Forward test:** runs on a data segment the EA was never optimised on and asks whether results repeat out of sample. 3. **Demo:** runs in real time on a virtual account for a few weeks and asks how the EA copes with live prices, spreads and delays. ## How To Backtest An EA In MT5 With The Strategy Tester ![How to backtest an EA in MT5 with the Strategy Tester: Settings tab with the EA, XAUUSD symbol, H1 timeframe, date range and starting deposit](https://backcomtrader.vn/assets/img/posts/media/2026/11/how-to-backtest-ea-mt5-strategy-tester-settings-2.webp) *Exness MT5 interface — Strategy Tester Settings tab* The **MT5 Strategy Tester** is the built-in testing module of MetaTrader 5. It runs an EA on historical data without placing a single real order. Traders open it by right-clicking an EA in the Navigator and choosing Test. The settings panel has these main fields: 1. **Expert:** the EA to test. 2. **Symbol and timeframe:** the main chart for the run, for example XAUUSD on H1. 3. **Date:** a preset range, or Custom period with your own start and end dates. 4. **Forward:** leave it at No for a plain backtest, or pick 1/2, 1/3, 1/4 to reserve the final part of the range for a forward test. 5. **Delays:** emulates execution delay to reproduce slippage and requotes. 6. **Modelling:** how price is simulated, which decides accuracy. 7. **Deposit and leverage:** starting capital and leverage. 8. **Optimization:** switch it off when running a single parameter set. According to the MetaTrader 5 documentation, a test starts at 00:00 on the first date and the end date itself is excluded. The tester also downloads at least 100 extra bars before the start date so the EA has data for its indicators. Direct reference: [the official MetaTrader 5 guide to testing Expert Advisors](https://www.metatrader5.com/en/terminal/help/algotrading/testing), checked on 9 November 2026. ### A Real Example: A Sample EA On XAUUSD In The MT5 Strategy Tester This example runs the Strategy Tester in MetaTrader 5 on an Exness server. The EA is the sample that ships with MetaTrader 5, run with default parameters. It illustrates the steps only and is not a trading recommendation. The settings for this run are: - **Expert:** Examples\Moving Average\Moving Average.ex5. - **Symbol:** XAUUSDm on H1. - **Date:** Custom period, 2026.10.09 to 2026.11.08. - **Forward:** No. - **Delays:** Zero latency, ideal execution. - **Modelling:** 1 minute OHLC. - **Deposit:** 10,000 USD with 1:100 leverage. - **Optimization:** Disabled. After you press Start, results appear in the Backtest and Graph tabs of the Strategy Tester. The next section explains why the Modelling field matters more than newcomers expect. ## Which Modelling Mode Should You Choose? The 5 MT5 Modes **Modelling mode** is how the tester rebuilds price movement inside each candle. The more detailed the mode, the closer the result to reality, but the longer the run and the more data it needs. | Mode | How it simulates | Use it when | | --- | --- | --- | | **Every tick** | Simulates every tick | The EA trades on ticks and needs high accuracy | | **Every tick based on real ticks** | Uses real ticks stored by the broker, no simulation | A final check before moving to demo | | **1 minute OHLC** | Emulates only Open, High, Low and Close of each minute | A quick check for EAs that work on candles | | **Open prices only** | Uses only the candle's opening price | The EA decides only when a new candle forms | | **Math calculations** | Downloads no history and only runs calculations | Testing an algorithm, not judging profit | **Modelling modes as described in the MetaTrader 5 documentation on 9 November 2026. Features can change between versions, so check them again in your own MT5 build.** The rule of thumb is simple. An EA that decides only on candle close can use Open prices only to screen ideas. A scalping EA, or one with a tight stop loss that depends on movement inside the candle, needs Every tick, ideally on real ticks. ### History Quality: Do Not Run On Missing Data The report includes a **History Quality** line showing the share of correct one-minute data against incorrect data or gaps. According to the MetaTrader 5 documentation, data segments with quality below 50% are shown in red. Low-quality data makes both good and bad results unreliable. ## How To Read A Backtest Report: A Real XAUUSD Example ![Reading an EA backtest report in MT5 on XAUUSD: net profit, profit factor, maximal drawdown and total trades in the Backtest tab](https://backcomtrader.vn/assets/img/posts/media/2026/11/read-backtest-report-xauusd-mt5-2.webp) *Exness MT5 interface — Strategy Tester Backtest tab* The **backtest report** sits in the Backtest tab of the Strategy Tester and collects every figure from the run. Beginners tend to look only at Total Net Profit, yet the risk metrics tell you whether the equity curve could survive on a live account. The table below shows the result of the run above. The three groups worth reading first are profit, drawdown and trade count. | Metric | Value | Meaning | | --- | --- | --- | | **History Quality** | 100% | One-minute data complete and correct | | **Total Net Profit** | 429.28 USD | Net gain on a 10,000 USD deposit | | **Profit Factor** | 1.57 | Gross Profit 1,185.35 divided by Gross Loss 756.07 | | **Balance Drawdown Maximal** | 339.62 USD (3.40%) | Largest balance drop, closed trades only | | **Equity Drawdown Maximal** | 679.87 USD (6.24%) | Largest drop including open trades | | **Recovery Factor** | 0.63 | Net profit divided by drawdown | | **Total Trades** | 23 | Trades over 30 days | | **Profit Trades** | 5 (21.74%) | Share of winning trades | **Figures from Exness MT5 on 9 November 2026, 1 minute OHLC mode, sample EA with default parameters. Past results do not represent future results.** ### Profit Factor, Expected Payoff And Recovery Factor According to the MetaTrader 5 documentation, **Profit Factor** is gross profit divided by gross loss, and a value of 1 means the two are equal, so anything above 1 means gross profit is larger. In the example, 1,185.35 divided by 756.07 gives about 1.57. **Expected Payoff** is the average expected gain per trade, here 18.66 USD. **Recovery Factor** is net profit divided by the maximum drawdown, showing how much the EA earned per unit of risk taken. A Recovery Factor of 0.63 means the net profit did not even cover the equity drawdown. That is a caution flag even though the Profit Factor looks decent. ### A Low Win Rate Can Still Be Profitable: Read Both Sides Only 5 of 23 trades won, or 21.74%, yet the total is positive. Dividing the report figures shows an average winner of roughly 237 USD against an average loser of roughly 42 USD. That is why the **win rate** alone cannot judge a strategy. Read it together with the size of winners and losers instead of picking an EA because it advertises 80% winners. ### Drawdown: A More Important Number Than Profit The report shows two kinds of **drawdown**, and they differ. Balance drawdown counts closed trades only, while equity drawdown includes open positions and therefore reflects the real dip more closely. The example has a balance drawdown of 3.40% but an equity drawdown of 6.24%. When judging what an account can endure, use the larger figure. The guide to [what drawdown is and how to calculate it](https://backcomtrader.vn/en/what-is-drawdown-in-trading-formula-recovery) covers this in depth. ### A Small Sample: 23 Trades Prove Very Little The run contains only 23 trades in 30 days. The Sharpe Ratio shows 2.43, and the MetaTrader 5 documentation treats 1.0 or higher as good, but with a sample this small the number carries little statistical weight. This example only shows how a report is read; it does not judge the sample EA. A serious backtest needs a long history covering different market conditions and hundreds of trades. ## Overfitting In Backtesting And Forward Tests: Why A Great Result Can Still Fail ![Overfitting in backtesting: a key that fits its mould perfectly but cracks in a different lock, a metaphor for a great backtest that fails on new data](https://backcomtrader.vn/assets/img/posts/media/2026/11/overfitting-backtest-forward-test-key-and-lock.webp) *Overfitting In Backtesting And Forward Tests: Why A Great Result Can Still Fail* **Overfitting** happens when an EA's parameters are tuned so tightly to one stretch of history that it looks excellent there and fails on new data. It is the most common reason a robot that shines in a backtest loses on a live account. Optimisation, which tries many parameter sets, always carries this risk: test enough sets and one will look good by chance alone. Three signs give it away: - A tiny parameter change makes the result collapse. - Profit is concentrated in a few single trades. - The strategy works only in one market phase. ### Forward Test Vs Backtest: What The Forward Setting Does A **forward test** reruns the best optimisation results on a different period, one on which the parameters were never tuned. According to the MetaTrader 5 documentation, the feature exists to avoid parameters being fitted to a particular area of historical data. In the Forward field of the Strategy Tester you choose 1/2, 1/3, 1/4 or Custom, and the final part of the range is set aside for the forward run. The documentation also notes that the closer the backtest and forward results are, the more likely the EA is to perform well in real trading. Direct reference: [the optimisation and forward testing section of the MetaTrader 5 guide](https://www.metatrader5.com/en/terminal/help/algotrading/strategy_optimization), checked on 9 November 2026. ## 7 Common Backtesting Mistakes To Avoid These mistakes repeat across many new traders, and most can be avoided with a quick check before you press Start. **1. Using too short a period.** A few weeks or a few dozen trades cannot support a conclusion. Cover trending, ranging and volatile phases. **2. Using a rough mode for a price-sensitive EA.** A scalping EA run on Open prices only will not give a realistic result. **3. Ignoring delay.** Zero latency gives a more ideal outcome than reality. Try Random Delay or a fixed delay to see how much slippage the EA can take. **4. Not checking trading costs.** Spread and fees eat into profit per trade, especially on short-term strategies. The guide to [what the Forex spread is](https://backcomtrader.vn/en/what-is-forex-spread) helps you count this properly. **5. Optimising too many parameters at once.** The more parameters you sweep, the higher the overfitting risk. **6. Looking only at net profit.** Read drawdown, Profit Factor, trade count and the spread of wins and losses together. **7. Using a fixed lot unrelated to capital.** A result on 10,000 USD does not transfer unchanged to a smaller account. Sizing lots by risk is covered in [Forex money management and lot size](https://backcomtrader.vn/en/forex-money-management-1-percent-rule-lot-size). ## From Backtest To Demo And A Live Account A passed backtest only lets an EA move on to real-time checks. A sensible workflow has four steps: 1. Backtest a long history with a suitable tick mode and check History Quality. 2. Forward test on data that was not optimised. 3. Run a demo for a few weeks to see spreads, slippage and how the EA behaves on live prices. 4. Go live with a small lot, increasing only while the numbers match the backtest. To see the robots BackComTrader features, visit the [EA bot trade page](https://backcomtrader.vn/en/lamboea) and backtest them yourself with the steps above before using them. Before choosing where to run an EA, check that the broker allows it. The [brokers for EA trading](https://backcomtrader.vn/en/forex-brokers-for-ea-trading) comparison covers this. For prop trading, EA rules differ by firm, so see the [prop firm EA trading rules](https://backcomtrader.vn/en/prop-firm-ea-trading-rules). ## Frequently Asked Questions (FAQ) About Backtesting EAs In MT5 **Is A Backtest Accurate?** Not completely. A backtest only simulates, and accuracy depends on the modelling mode, data quality and the assumptions about spread and delay. Treat the result as first evidence, then check further with a forward test and a demo. **How Many Years Of Data Is Enough?** There is no single threshold for every strategy. The data should cover different market phases and produce hundreds of trades. One month with 23 trades, as in the example above, only suits learning how to read a report. **Does A Great Backtest Mean The EA Will Profit?** No. A great backtest only shows the strategy once worked on the data that was run. Overfitting, real costs and changing markets can all shift the outcome, so run a forward test and a demo before using real money. ## Conclusion: What Backtesting Can And Cannot Tell You **Backtesting** is the step that removes weak ideas using past data, not proof of future profit. Traders should weigh three things together: data quality, modelling mode and risk metrics such as drawdown. The practical routine is to run enough data, read Profit Factor, Recovery Factor and the trade distribution, check overfitting with a forward test, then go through demo before committing capital. For the basics first, read [what a Forex Expert Advisor is](https://backcomtrader.vn/en/what-is-a-forex-expert-advisor) and come back to practise in the Strategy Tester. > **Disclaimer:** This content is compiled by BackComTrader for information only and is not investment advice, a trading recommendation or an assessment of any specific EA. The figures in the example come from one illustrative run of a sample EA; past results do not guarantee future results. Trading Forex and gold carries a risk of losing capital. ## Related Posts [View all](https://backcomtrader.vn/en/blog) [![Sent crypto to wrong network: a glowing glass coin rolling off the correct track toward a dark gate at the edge of a cliff](https://backcomtrader.vn/assets/img/posts/media/2026/11/sent-crypto-to-wrong-network-recovery-thumbnail.webp) Guides30/11/2026 Sent Crypto To Wrong Network? What Can Be Recovered And How To Avoid It Sent crypto to wrong network? See which mistakes exchanges may recover, what the fees look like, the first steps to take and how to avoid it next time. 13 min read](https://backcomtrader.vn/en/sent-crypto-to-wrong-network-recovery) [![Glass shield with an open padlock, Exness logo and a crossed-out Wi-Fi icon illustrating an Exness account opening error](https://backcomtrader.vn/assets/img/posts/media/2026/11/exness-account-opening-error-thumbnail-v2.webp) Guides20/11/2026 Exness Account Opening Error: Network, Verification And How To Fix It Through Official Channels Traders who hit a network error, miss the email code or SMS, or have documents rejected while opening an Exness account can diagnose each screen in order. This guide covers official-channel fixes. 14 min read](https://backcomtrader.vn/en/exness-account-opening-error-fixes) [![Exness deposit and withdrawal: payment methods, processing time, limits and common errors](https://backcomtrader.vn/assets/img/posts/media/2026/11/exness-deposit-and-withdrawal-time-thumbnail.webp) Guides20/11/2026 Exness Deposit And Withdrawal: Payment Methods, Processing Time, Limits And Common Errors An instant label in the Personal Area does not mean the money is already in your account. Learn which methods your region shows, why card deposits are refunded first, and how to read and fix a rejected withdrawal. 13 min read](https://backcomtrader.vn/en/exness-deposit-and-withdrawal-time) --- Canonical HTML: https://backcomtrader.vn/en/how-to-backtest-an-ea-in-mt5 · Updated: 2026-11-18T17:28:29+00:00