MetaTrader 8 min read

How to Backtest on MT4 and MT5

Tim Maunsell

18 Sep, 2025

Trader analyzing forex and stock charts on dual monitors and a laptop, using candlestick patterns and technical indicators at a desk with notebook and calculator.

Backtesting in forex, using tools like the Strategy Tester on MT4/5, allows traders to evaluate the performance of their strategies on historical data. 

Let's discuss in depth how traders can backtest on MT4 and MT5.

This is an example only to enhance a consumer's understanding of the strategy being described above and is not to be taken as Blueberry Markets providing personal advice.

What is backtesting?

Backtesting is the process of testing a trading strategy using historical data. It helps traders evaluate a strategy's performance before using it in live markets. By simulating trades based on past market conditions, traders can see how a strategy would have performed. This allows them to refine and adjust their approach to improve future results.

How does backtesting help traders?

Identifies optimal parameters

Backtesting helps identify the right settings for a trading strategy. It allows traders to adjust parameters such as stop-loss levels, take-profit targets, or indicators to improve performance.

Saves time and costs

Backtesting allows traders to test strategies without executing live trades. It saves time and money by preventing costly mistakes that could happen in real-time markets.

Increases confidence

Backtesting builds confidence in a strategy's potential. Traders can feel more confident when they see positive results from historical performance, which can improve their decision-making in live markets.

Limitations of backtesting

Data quality issues

Backtesting results depend on the quality of historical data. Inaccurate or incomplete data can lead to misleading results, which can affect the reliability of strategy evaluations.

Overfitting risk

Backtesting may lead to overfitting, in which a strategy is excessively tailored to past data. This can result in poor performance in live markets, as the strategy doesn't adapt well to new market conditions.

No account for slippage

Backtesting doesn't always factor in slippage (the difference between expected and actual execution prices). This can lead to overly optimistic performance predictions.

Stepwise guide to backtest on MT4

  1. Understand the problem with default history data in MT4

    Default history data in MT4 is unreliable for precise backtesting. It uses bar data to simulate ticks. This can lead to inaccuracies, especially in fast-moving strategies like scalping. This data does not cycle through each tick delivered in historical data, resulting in a flawed performance analysis.
  2. Choose a third-party tick data provider

    To overcome the above limitation, opt for third-party tick data providers. These providers offer high-quality, detailed tick data for better backtesting accuracy. Choose a provider based on the broker or desired historical data range.
    MT4 strategy tester window showing expert advisor setup for EUR/USD with tick data, model selection, date range, spread, and optimization options.

    image source

  3. Download Tick Data Suite (TDS)

    Download and install Tick Data Suite (TDS), a tool that enhances MT4's backtesting capabilities. TDS offers access to high-quality tick data for accurate backtesting. 
    Tick Data Manager window showing Dukascopy selected as data source, with currency pairs listed for download. EUR/USD operations dialog open to set start and end dates for tick data download.

    image source

  4. Select the broker and data source

    Once TDS is installed, open the 'Tick Data Manager.' Choose the broker and select the pairs and time period for downloading the required tick data. Click on the download icon and specify the time range to get the data.
    MetaTrader 4 platform with EUR/USD candlestick chart and MACD indicator, showing the Strategy Tester window for backtesting expert advisors.

    image source

  5. Select the time period for data download

    Decide on the historical data range one needs for the backtest. The time period is important, especially for testing strategies over extended periods. TDS allows traders to specify the exact timeframe for accurate historical data.
    MetaTrader 4 strategy tester settings window for backtesting MACD sample expert advisor on EUR/USD, with options for period, spread, model, date range, and visual mode enabled.

    image source

  6. Close MT4 and reopen after downloading data

    Once the tick data is downloaded, close the MT4 platform if it was open during the download process. Reopen it to ensure that MT4 correctly integrates the new data, making it available for backtesting.
    MetaTrader 4 History Center window showing EUR/USD M1 data with columns for time, open, high, low, close, and volume across different timeframes.

    image source

  7. Enable tick data in Strategy Tester

    After reopening MT4, go to the Strategy Tester. Check the box labeled 'Use Tick Data' to enable third-party tick data for the backtest. This ensures that the backtest uses high-quality, detailed tick data rather than the default bar data.
    MT4 Strategy Tester with Tick Data Settings window open, showing EUR/USD selected from Dukascopy source and option to use variable spread highlighted.

    image source

  8. Select 'every tick' testing model

    In the Strategy Tester, choose the 'Every tick' model for backtesting. This option ensures the tester uses all ticks for each bar, simulating the market more accurately for detailed performance evaluation.MetaTrader 4 strategy tester window configured for a Moving Average expert advisor on EUR/USD, showing model selection with ‘Every tick’ highlighted for precise backtesting.

    image source

  9. Set the spread option

    Set the spread option in the Strategy Tester. Select 'Variable Spread' to account for real market conditions. Here, the spread changes dynamically based on market volatility and liquidity rather than using a fixed spread.

    MT4 Strategy Tester with Tick Data Settings window open, showing EUR/USD selected from Dukascopy source and option to use variable spread highlighted.

    image source

  10. Emulate real trading conditions

    To simulate realistic trading conditions, go to the 'Tick Data Settings' in TDS. Enable the 'Use variable spread' option and select 'Enable slippage.' This will mimic real market conditions, including potential delays and price deviations during live trading.“MT4 testing profile settings with slippage options enabled, allowing configuration of points, deterministic algorithm, and application on order entry, close, take profit, and stop loss.

    image source

  11. Configure settings

    In the 'Basic' tab of the Tick Data Settings, adjust the broker's GMT offset and daylight savings time. Also, enable the 'Commission' option and input the broker's commission fees to model transaction costs accurately in the backtest.MT4 tick data settings advanced tab showing commission setup, with base commission set to 6 per lot round trip, and options to simulate stop loss, stop orders, take profit, and limit orders.

    image source

  12. Run and review the backtest

    Finally, run the backtest in MT4 using the 'Every tick' model with variable spread and slippage. Review the results to evaluate the trading strategy's performance under realistic market conditions.

Stepwise guide to backtest on MT5

  1. Open MetaTrader 5 and go to Strategy Tester

    The trader launches MetaTrader 5 and navigates to the Strategy Tester. This is where they can set up their backtest for the Expert Advisor (EA).MetaTrader menu with View tab open, showing options like Market Watch, Data Window, Navigator, and Strategy Tester highlighted with shortcut Ctrl+R.

    image source

  2. Select the Expert Advisor (EA)

    The trader selects the EA they want to test from the Strategy Tester's drop-down menu. This is the automated trading strategy to be backtested.MetaTrader platform with Navigator window open, showing Expert Advisors menu where ExpertMACD is selected, and Strategy Tester settings configured for backtesting on EUR/USD with custom date range and every tick model.

    image source

  3. Choose the testing symbol

    The trader picks the symbol or asset for backtesting, such as a currency pair, stock, or commodity.MetaTrader 5 Strategy Tester settings configured for MultiMovings expert advisor on EUR/USD M30, with custom date range, deposit size, optimization method, and visualization enabled.

    image source

  4. Set the testing period

    The trader specifies the time frame for the backtest, which allows the strategy to be tested against historical price data over a chosen period.MetaTrader 5 Strategy Tester settings window showing MultiMovings expert advisor configured for EUR/USD on M30 timeframe with custom date range, deposit, and fast genetic optimization algorithm.

    image source

  5. Select the testing model

    The trader chooses a testing model based on their needs. 'Every tick' provides the highest accuracy, while '1 minute OHLC' is faster but less precise.MetaTrader 5 Strategy Tester settings configured for MultiMovings expert advisor on EUR/USD M30, with custom date range, deposit size, optimization method, and visualization enabled.

    image source

  6. Configure EA input parameters

    The trader adjusts the input settings for the EA. This customization simulates different trading conditions for the strategy.MetaTrader Strategy Tester Inputs tab showing ExpertMACD input parameters, including fast period, slow period, signal period, take profit, and stop loss values with start, step, and stop ranges.

    image source

  7. Enable optimization (optional)

    The trader enables optimization to test various input parameters automatically. This helps identify the right settings for the EA's performance.
  8. Run the test

    The trader initiates the backtest and allows the EA to simulate trades using historical data. They monitor its execution to assess performance.MetaTrader 5 Strategy Tester Inputs tab showing ExpertMACD variables, including fast and slow MACD periods, signal period, take profit, and stop loss with configurable ranges.

    image source

  9. Monitor test results

    As the test runs, the trader tracks real-time results. They focus on key metrics such as gains, drawdown, and other performance indicators.

  10. Analyze results and make adjustments

    After the test, the trader reviews the results. Based on performance, they adjust the EA's parameters to improve outcomes.

  11. Run MQL5 Cloud Network for faster testing (optional)

    If faster results are needed, the trader enables the MQL5 Cloud Network. This uses distributed computing resources to speed up testing and optimization.

Why backtesting matters for traders?

Backtesting allows traders to evaluate strategies using historical data, identify optimal parameters, and reduce risks. It helps refine trading plans, improves confidence, and saves time by simulating real market conditions, leading to better-informed decisions before live trading.


Disclaimer: All material published on our website is intended for informational purposes only and should not be considered personal advice or recommendation. As margin FX/CFDs are highly leveraged products, your gains and losses are magnified, and you could lose substantially more than your initial deposit. Investing in margin FX/CFDs does not give you any entitlements or rights to the underlying assets (e.g. the right to receive dividend payments). CFDs carry a high risk of investment loss.
MetaTrader

Trade smarter, faster, better