How to Backtest an EA on MT4
BY TIOmarkets
|June 10, 2026Backtesting an Expert Advisor on MetaTrader 4 is the process of running an EA's logic against historical price data to see how it would have performed during a past period. The Strategy Tester built into MT4 handles the whole workflow, from loading the EA and selecting a symbol through to producing a full performance report.
This guide walks through a complete EA backtest in MT4: what you need before you start, how to load and configure the EA in the Strategy Tester, how to choose appropriate test settings, how to interpret the key statistics in the report, and the limitations to keep in mind when judging the results.
What Backtesting an EA Tells You
A backtest simulates how an Expert Advisor would have placed and managed trades over a defined historical period. The output includes the resulting balance and equity curves, a list of every simulated trade, and a report of summary statistics such as total profit, drawdown, win rate, and risk metrics.
What backtesting can tell you: how the EA's logic interacts with past market behaviour, the rough shape of its equity curve, whether it produces consistent or erratic results across different conditions, and whether the parameters chosen are reasonable.
What backtesting cannot tell you: how the EA will perform in live markets going forward. Past performance is not indicative of future results. Backtested spread and slippage are modelled, not real. The actual experience of trading the EA live will differ from the backtest, sometimes significantly.
A well-conducted backtest is a useful diagnostic step before running an EA on a demo account, and a demo run is a useful step before considering live deployment. Skipping either step removes a layer of evidence about whether the strategy holds up under real conditions.
Before You Start
A few things need to be in place before you run a backtest.
The EA must be installed in MT4. Expert Advisors are .ex4 files placed in the MQL4/Experts folder. To check, open the Navigator window (Ctrl+N), expand Expert Advisors, and confirm the EA you want to test appears in the list.
Historical data for the symbol and timeframe must be available. MT4 typically pre-loads recent history, but for tests covering longer date ranges, you may need to download additional data via Tools > History Center.
Confirm the EA's documentation. Most EAs have specific requirements such as a particular timeframe or symbol, minimum account size, and recommended parameter ranges. Backtesting outside those conditions can produce misleading results.
Loading the EA in the Strategy Tester
Open the Strategy Tester via View > Strategy Tester or by pressing Ctrl+R. The tester opens as a panel at the bottom of the platform.
In the test type dropdown, select Expert Advisor. The dropdown to the right lists all EAs installed in the MQL4/Experts folder. Select the EA you want to test.
Select the Symbol and Period for the test. Choose values consistent with the EA's intended use. A scalper EA designed for M5 GBPUSD will not produce meaningful results if backtested on D1 USDZAR.
Configuring Expert Properties
Click the Expert Properties button. The Expert Properties dialog opens with three tabs.
The Testing tab controls the simulated account environment:
- Initial deposit: the simulated starting balance. The default is typically 10,000. Set this to a value representative of how you would deploy the EA in live trading.
- Currency: the account currency for the test. Default is USD. Set this to match your intended live account currency.
- Positions allowed: Long & Short (default, recommended for most EAs), Long only, or Short only. Restricting direction can be useful for diagnosing how much of the EA's performance comes from each side.
The Inputs tab lists every input parameter defined by the EA. Each parameter has a default value set by the EA's developer. You can override any value here for this specific test run. Common inputs include lot size, stop-loss distance, take-profit distance, magic number, and strategy-specific parameters.
The Optimization tab is used when running an optimisation pass. Tick the Variable checkbox next to a parameter, then set Start, Step, and Stop values to define the range of values to test.
Click OK to confirm the Expert Properties.
Choosing Test Settings
In the main Strategy Tester panel, configure the rest of the test.
Spread: select Current (the live spread at the time the test starts) or set a specific value in points. For 5-digit forex pairs, 10 points equals 1 pip.
Model: choose between Every tick (most accurate, slowest), Control points (middle), or Open prices only (fastest, least accurate). For meaningful results, Every tick is preferred where data quality allows. Open prices only is suitable for quick iteration but not for final evaluation.
Use date: tick this to define a specific From and To date range. For initial backtests, a range covering several years gives a broader view of EA behaviour across different market conditions.
Visual mode: when ticked, the test plays out visually on a chart. Useful for diagnosing individual trades, but slows the test considerably. Disable for production runs.
Running the Backtest
Click Start. The Strategy Tester begins processing the historical data. The status bar at the bottom shows progress through the date range and the number of ticks processed.
For a multi-year test in Every tick mode, the run can take several minutes to several hours depending on the data range, the EA's complexity, and the speed of your computer.
When the test finishes, the output appears across the tabs at the bottom of the Strategy Tester.
Reading the Report Tab
The Report tab is the most important output for evaluating EA performance. The key statistics include:
Total net profit: the gross profit minus the gross loss. Headline performance figure.
Gross profit and Gross loss: separated for context. A strategy with a high gross profit but an equally high gross loss is a high-turnover, high-cost strategy.
Profit factor: gross profit divided by gross loss. A profit factor above 1 means the EA is net profitable in backtest. A profit factor of 2 means twice as much was earned as lost. A profit factor below 1 means the EA lost money over the test period.
Expected payoff: the average result per trade. A small positive expected payoff over many trades can compound into meaningful returns; a small negative expected payoff means the strategy is unlikely to be viable.
Absolute drawdown: the difference between the initial deposit and the lowest balance reached during the test.
Maximal drawdown: the largest peak-to-trough drop in balance during the test, expressed in account currency and as a percentage.
Relative drawdown: the largest peak-to-trough drop as a percentage of the peak balance.
Total trades: the number of trades placed during the test. A small sample (under 30 trades) is statistically unreliable; aim for tests producing several hundred trades or more.
Profit trades and Loss trades: shown as counts and percentages.
Largest profit trade and Largest loss trade: useful for identifying outlier trades that may be skewing the overall result.
Average profit trade and Average loss trade: useful for assessing the typical winner and loser sizes. A strategy with very small winners and one occasional large loss is fragile.
Maximum consecutive wins and Maximum consecutive losses: in counts and currency amounts. Long streaks of losses can be a problem even when overall performance is positive.
Modelling quality: a percentage indicating data completeness. 90% is the highest, 25% is typical for Open prices only mode. Treat anything below 90% as an approximation.
Reading the Graph and Results Tabs
The Graph tab plots the equity curve and balance curve over the test period. A smooth, steadily rising line indicates consistent performance. A choppy or stair-stepped line indicates uneven performance. Sharp drops are large drawdowns; check these against the report's maximal drawdown figure.
The Results tab lists every simulated trade with entry time, exit time, prices, volumes, and profit. Useful for inspecting specific trades that look unusual on the equity curve, and for confirming the EA is doing what its logic should be doing.
The Journal tab records events during the test, including errors and warnings emitted by the EA. Always scan the Journal for issues. Errors there often explain unexpected backtest results.
Optimisation Runs
If you want to test multiple parameter combinations, tick the Optimization checkbox in the Strategy Tester before starting. Configure parameter ranges in the Expert Properties > Optimization tab.
When the optimisation completes, an Optimization Results tab appears. Each row represents one parameter combination, with columns showing profit, profit factor, drawdown, and other key statistics. Sort by Profit factor or Total net profit to identify the best-performing combinations.
A critical caution: parameters that look excellent in optimisation often fail in live trading because they have been fitted too closely to historical price action. This is called curve-fitting. A best-performing optimisation result that vastly outperforms similar parameter combinations is a red flag, not a green one. Look for parameter regions that perform consistently well, not single combinations with outlier results.
Limitations of Backtesting
Backtesting has well-documented limitations that should temper any conclusions drawn from a report.
Past performance does not guarantee future results. Market conditions change, and a strategy that worked over one period can fail in another.
Backtested spread is modelled, not real. The variable spread that occurs in live markets, especially around news events and at session opens, is not represented faithfully.
Backtested slippage is not modelled in MT4. Orders execute in the backtest at the requested price; in live markets, fast-moving prices can produce material slippage.
Historical data quality varies. The modelling quality figure in the report is the key indicator. Tests below 90% should be treated as approximations.
The MT4 Strategy Tester is single-threaded, which makes long optimisation runs CPU-bound and time-consuming.
Backtests cover one symbol at a time. Strategies that depend on multi-symbol relationships are not testable in MT4. The MT5 strategy tester supports multi-currency testing.
A backtested EA should be run on a demo account before being considered for live use, to validate behaviour against current market conditions in real time.
Trading at TIOmarkets
TIOmarkets offers MetaTrader 4 and MetaTrader 5 on desktop, web, and mobile, across four account types. The Standard account is created automatically on registration with a minimum deposit of $20 or currency equivalent. The Raw and VIP Black accounts are opened separately through the client area. The Nano account is MT5 only with a $20 minimum deposit, USD only. Hedging is supported on all accounts. A swap-free Islamic account is available; contact TIOmarkets for eligibility and instrument requirements. Copy trading is available on both MT4 and MT5.
Orders are executed at the best available market price, which may result in positive or negative slippage. Demo accounts often execute instantly and may not fully replicate live slippage conditions. Spreads are variable and are typically higher than minimum figures shown. Leverage on each instrument is subject to change depending on market conditions and applicable regulatory requirements.

FAQ
Risk disclaimer: CFDs are complex instruments and come with a high risk of losing money rapidly due to leverage. You should consider whether you understand how CFDs work and whether you can afford to take the high risk of losing your money. Never deposit more than you are prepared to lose. Professional client’s losses can exceed their deposit. Please see our risk warning policy and seek independent professional advice if you do not fully understand. This information is not directed or intended for distribution to or use by residents of certain countries/jurisdictions including, but not limited to, USA & Countries included in the OFAC sanction list. The Company holds the right to alter the aforementioned list of countries at its own discretion.
TIOmarkets offers an exclusively execution-only service. The views expressed are for information purposes only. None of the content provided constitutes any form of investment advice. The comments are made available purely for educational and marketing purposes and do NOT constitute advice or investment recommendation (and should not be considered as such) and do not in any way constitute an invitation to acquire any financial instrument or product. TIOmarkets and its affiliates and consultants are not liable for any damages that may be caused by individual comments or statements by TIOmarkets analysis and assumes no liability with respect to the completeness and correctness of the content presented. The investor is solely responsible for the risk of his/her investment decisions. The analyses and comments presented do not include any consideration of your personal investment objectives, financial circumstances, or needs. The content has not been prepared in accordance with any legal requirements for financial analysis and must, therefore, be viewed by the reader as marketing information. TIOmarkets prohibits duplication or publication without explicit approval.
Join us on social media
Authors BIO

Behind every blog post lies the combined experience of the people working at TIOmarkets. We are a team of dedicated industry professionals and financial markets enthusiasts committed to providing you with trading education and financial markets commentary. Our goal is to help empower you with the knowledge you need to trade in the markets effectively.





