How to do a Forex backtesting on MT4?

Backtesting helps traders to develop and improve their trading strategies. Moreover, backtesting is highly used in assessing the profitability of given trading strategies in certain markets before going live.

Home / Guides / How to do a Forex backtesting on MT4?
How to do a Forex backtesting on MT4?

MetraTrader 4 is one of the most widely used trading platforms in Forex. The platform is trusted by over 1,200 forex brokers worldwide. MT4 is a highly reliable and time tested platform that enables traders to backtest trading strategies.

Backtesting helps traders to develop and improve their trading strategies. Moreover, backtesting is highly used in assessing the profitability of given trading strategies in certain markets before going live.

While it is true that past performance does not guarantee future results, backtesting is the best way to prepare your strategies for live trading. The backtesting process on MT4 usually involves backtesting algorithms called Expert Advisors. In this guide we’ll walk you through the process of backtesting using MetaTrader 4 trading platform.

What is backtesting and how is it done?

Every market is different. In addition, every trader is different and what works for you, might not work for another trader. What’s more, market conditions often change for a given asset. This is why you can’t just buy a trading strategy and hope that it will work best. The best way to prepare for trading live is to backtest your trading systems and strategies. Let’s dive deep and find out how to do it.

Backtesting vs Demo trading

Backtesting refers to the process of analyzing the effectiveness of trading strategy or analytical method by using past data.

Backtests can be simple or incredibly complex, depending on the strategy being tested. Traders can choose between automated, software-based backtesting or go through the process manually, identifying trades one by one.

The percentage of net returns of a strategy can help traders decide whether it is the right fit for their trading objectives. Backtesting is very similar to demo trading as both are using virtual funds to determine how profitable the trading systems are. However, they are very different from one another. Demo trading is conducted in a live-like environment. The only difference is that the trading funds are virtual. In backtesting funds are also virtual, in addition, you have the control over time. In backtesting, you can place an order and see if that order was a success in a blink of an eye. As a result, backtesting saves a lot of time and energy.

Manual backtesting

To conduct a manual backtest, you can follow these basic steps:

  • Define the features and parameters of your strategy – backtesting does not require putting your capital at risk and you can choose the scope and features of the strategy you want to backtest
  • Choose the target market and time frame for the backtest – you can backtest a strategy for specific markets and for a set period of time. Select the markets of your choice and the time period used to gather data from
  • Look for trades from across the time period you would like to backtest
  • Find entry and exit points on the price chart until all trades across the time period have been identified
  • To calculate your gross return, add up the winning and losing trades for the period
  • To calculate your net return, deduct any commission or other charges from the gross return figure
  • Compare your net returns to the capital required to execute highlighted trades across the time period

Advantages and disadvantages of backtesting in forex

Backtesting can be a complex and time-consuming process that involves multiple variables. The results received through backtesting may not be completely accurate, however, this depends on the complexity of the strategy in question and can vary considerably.

Advantages

Some of the advantages of backtesting are:

  • Testing the profitability of a strategy – you can test the performance of a strategy across multiple different time periods, which can also be done by your expert advisor to determine whether to stick with the strategy
  • Identifying weaknesses in your expert advisor – backtesting can unveil shortfalls in your expert advisor and direct you towards making necessary adjustments
  • Finding key areas of improvement in your strategy – the purpose of backtesting is to find flaws in your strategy and work on fixing them. These flaws may include missing opportunities or maintaining unprofitable positions
  • Testing a new Expert Advisor bot – it is always advisable to backtest an EA after purchasing it before using it in trading
  • Anticipating possible future performance and catalysts – backtesting can identify important points and patterns on a chart that can give some insight into the possible direction of the price. However, past performance does not guarantee future results

Disadvantages

Some of the unfortunate drawbacks of backtesting may include:

  • Actual behavior may differ from backtesting – this may differ from broker to broker based on their execution speed
  • Past performance does not guarantee future results – the strategy that works in a bull market, is unlikely to work as well in a bear market, and vice versa
  • Backtesting using bigger time frames can be misleading as market conditions change overtime.

Setting the conditions for a backtest on MetaTrader 4

MetaTrader 4 is one of the most frequently used forex trading platforms that offers both automated and manual backtesting. Before you start with the backtesting process, however, you must first go through a few small steps to have the platform up and running for the test:


Recommended Brokers
Simply trading by markets.com - Onine, On App, On Your Side.

Join over 25 million worldwide who have already chosen the Plus500 Group

Regulated in 7 jurisdictions. Chosen by 400,000 traders globlaly

Online trading with better-than-market conditions

Trade with spreads from 0.0 pips, no requotes, no price manipulation and no restrictions.

A powerful multi-asset trading app. Design and build your own investment portfolio.

  • Enable the backtesting feature on MT4 – switch to the View menu at the top-right corner and select the ‘Strategy Tester’ feature
  • Choose automatic or manual backtesting – the lower side of your screen will show the backtesting window where you can use EAs and indicators to start with the backtest. You can choose to conduct the backtest manually, if so desired
  • Prepare the data for backtesting – this is the step where MT4 may be less efficient, as it does not offer full price history, which is inconvenient for users who wish to run a backtest over longer time periods
  • Download the data – you can do this by using the ‘Tools’ menu by selecting ‘History Center’ that will show you various time frames that you can download and input into your backtest. After gathering all the necessary data, you can begin the backtest

How to backtest forex strategies on MetaTrader 4?

Automated backtesting is a simple, straightforward process. Some EAs are developed to help backtest trading strategies and they can be run as Expert Advisors. Select ‘Expert Advisor’ in MT4’s Strategy Tester (from the drop-down list), select the currency pair and timeframe, the start and end dates, additional input parameters for the expert advisor and press ‘Start’. MetaTrader will use the data to conduct a backtest and deliver the results.

Expert Advisor is not the only choice available for backtesting, but this is the example we will use for the sake of simplicity. Expert Advisors can be manually built, or downloaded from third parties.

Choose the desired currency pair from the drop down menu, which will be the same symbols as the ones you’ve picked from the Market Watch menu.

After that, you can select the desired timeframe. MT4 typically offers 7 different timeframes that range from hourly to monthly results. The maximum time frame is 30 months.

You can also choose between three models – Open prices, every tick, and control points. ‘Every Tick’ is the most accurate option according to MT4, therefore, we will choose this option.

In the ‘Spreads’ menu, you can choose between spreads of different pip sizes (2, 5, 10, 30, 50, or 100). In the ‘Expert Properties’ section, you can go into more detail and select the initial deposit, currency, position type, etc.

You can initiate the backtest by pressing the ‘Start’ button.

Analyzing forex backtest results

MetaTrader 4 will deliver your results within seconds and you can get an overview of key data, such as net total payout, winning and losing positions, number of positions, etc.

You can use this information in determining the quality of your strategy and make meaningful adjustments wherever necessary.

The key to conducting a successful backtest with meaningful results is gathering quality data for the expert advisor to analyze. If the data is insufficient or irrelevant, this can render the backtest obsolete and the results will be misleading.

Main takeaways from forex backtesting on MT4

  • Traders can use MetaTrader 4 to backtest expert advisors and indicators to test strategies based on past performance
  • Backtesting comes with its advantages and limitations, with the key limitation being a focus on past performance, which may become redundant in the future
  • The purpose of backtesting is to test existing strategies to find flaws and correct them , or to examine different ones without pledging capital and incurring losses firsthand
  • Automatic backtesting using an Expert Advisor is a straightforward process that only takes a few minutes to complete

FAQs on how to backtest forex strategies on MT4

What does backtesting mean in forex?

Backtesting in forex involves testing trading strategies by using historical chart data. When traders are using MetaTrader 4 platform, they can run backtesting tools as Expert Advisors or automatically test strategies using strategies tester.

Can I backtest on MT4?

MT4 offers both manual and automated backtesting to its users. Using expert advisors to backtest is especially convenient and is done in a matter of minutes. The drawback of using MT4 for backtesting is the limited time frames available to choose from.

What trading strategies can I backtest on MetaTrader 4?

Traders can backtest virtually any strategy on MT4 – anything that can be implemented on MetaTrader 4, can also be backtested on the platform.

Latest

Best Brokers
Simply trading by markets.com - Onine, On App, On Your Side.

Join over 25 million worldwide who have already chosen the Plus500 Group

Regulated in 7 jurisdictions. Chosen by 400,000 traders globlaly

Online trading with better-than-market conditions

Trade with spreads from 0.0 pips, no requotes, no price manipulation and no restrictions.

A powerful multi-asset trading app. Design and build your own investment portfolio.