How does backtesting on MT4 work? - A beginner’s guide

Backtesting in trading is a method of evaluating a certain strategy by applying it to the historical market data. It basically indicates whether the given strategy would be successful in the past, which then gives traders and analysts confidence to actually incorporate that strategy in their future trades.
 
There are two types of backtesting methods: automatic and manual. Automatic backtest is done using strategy tester and manual testing is done using computer programs that can be run as EAs on your MetaTrader platform. To perform automatic strategy backtesting on MetaTrader 4, you first need to enable that feature from the View sub-menu. After that, the Tester window will appear down at the bottom. This window will contain two main elements – Expert Advisor and indicator. This means that you can do backtesting on these two elements.
 
Next up, you need to pick the modeling method: Every tick, Control points, or Open prices only. As the software itself recommends, the tick model is the most precise way of backtesting your EA strategy. As for spreads, you can either decide the current one or specific pips. Every currency pair moves differently, therefore, traders also need to select which pairs they want to backtest and what time period to use.
 
Once that’s done, you can press the Start button and let the system do its job. Based on the timeframe and the strength of your processor, the results in the next section should appear soon

Start Trading in 10 Minutes

Apply everything you’ve learnt on a real trading account with up to 1:2000 leverage, negative balance protection and outstanding support.
Get Started

Backtesting - MT4 strategy tester

Trading using a trading strategy is critical for success in trading. However, it's not enough. In order to consistently make money in the market, you need your strategy to fit your personality. There's a million ways to make money in the markets and what works for one trader, the exactly same approach will never work for the other. To find and develop a trading strategy, learning how to backtest is a must. 
 
With backtesting, they can test out the effectiveness of their strategies by applying them to the historical market data. Basically, if the backtesting works and the simulation results in a payout, the chances of the strategy doing the same in the live environment increases. The key here is to take the historic data from a time period that is relevant today. Too old data can be useless for most currencies as market conditions often change.

Prerequisites of backtesting on MetaTrader 4

When it comes to automatically backtesting your trading strategies on MT4, there are a few things you need to do first. Initially, you need to enable this feature in the terminal. You can do that by going to the View menu in the top-right corner of the screen and selecting the Strategy Tester feature.

After that, the respective window will appear at the lower part of the window. That’s where the whole process of MT4 backtesting takes place. As for the actual testing elements, you can use Expert Advisors and indicators for the automatic backtesting.

However, those aren’t the only testable elements in MT4. Traders with a bit more experience with MetaTrader 4 can also backtest their own strategies manually, although it is more complicated than automatic backtesting. For the sake of simplicity, we’ll focus on backtesting Expert Advisors on MT4.

Another initial step traders need to take is to download the appropriate historical data for the specific instrument. More often than not, MT4 doesn’t offer the price historical data to the full extent, which can cause inefficiencies in the backtesting.

You can download the data by heading over to the Tools menu and selecting the History Center. There, you need to select the appropriate symbol and double press it. It will bring out various timeframes that you’ll be able to import to your system. At the end of it, MT4 will have enough data to conduct backtesting on your instrument.

How to backtest on MetaTrader 4?

Now, let’s talk about how you can actually start backtesting your automatic trading strategies on MT4. When the Strategy Tester window appears, it will show various buttons and drop-down menus for different elements.

How to backtest on MetaTrader 4

First things first, you need to choose Expert Advisor as a testable element and select a specific EA program. Of course, you can also select MT4 backtesting indicators on that same menu, but as noted earlier, we’ll focus on EA backtesting.  You can create your own Expert Advisor, as well as download the already-created one from the internet.
 
After that, you have to select your preferred trading symbol which, usually, will be a Forex pair because MT4 is quite limited in its trading instruments. The number of available instruments in the collapsing menu depends on your symbols selected in the Market Watch window.

MT4 backtesting tutorial

The next step is to select the appropriate time frame, as well as the Model of backtesting. There will typically be 7 different timeframes and three models: Every tick, Control points, or Open prices only. MT4 itself suggests that the Every tick option is the most accurate method based on all available timeframes, therefore, we’ll also choose this option.
 
When it comes to the Spreads menu, you can either select the current option or six different points (2, 5, 10, 30, 50, or 100 pips). Again, for the highest accuracy, it is generally a good idea to pick the current option.
 
The Expert properties button will take you to the window where you can decide the initial deposit, the currency of your deposit, the type of position (long/short/both), etc. This is the area where you can provide more specific details about your preferred position.


Getting the results

After that, the only remaining step you need to take is to press the Start button and initiate the MetaTrader 4 backtesting. The results will be displayed in the Results tab of the Tester window in a few seconds or minutes, depending on the timeframe you selected, as well as the computing power of your desktop device.
 
Those results will include simplistic data about the total net payout, as well as loss, the number of positions with positive/negative outcomes, and many more. In short, traders can get pretty comprehensive information about whether their strategy would actually work in the past. This, in turn, would help them decide whether to use that strategy in real life or not.

Manual MetaTrader backtesting

Backtesting manually takes more time as you need to backtest strategies at human speed. However, manual backtesting gives traders the ability to backtest strategies that are not testable automatically. For instance, you can manually backtest in MT4 chart patterns and trading setups. Strategy tester tool is a great way to test simple trading rules that are based on pure data and not on complex analysis. In case you are using a complex trading system that involves visually locating price patterns, trendlines, etc. then you need to test your strategies manually. How to backtest on MT4 exactly? It's very simple, you can find a download of a manual backtesting algorithm from MetaTrader marketplace. There are paid and free types of manual backtesting tools. These algorithms then can be run as Expert Advisors. Once you install the backtesting EAs, you can select the asset to backtest, account currency, balance and time period.

Keep in mind that when backtesting either manually or automatically, selecting the proper period is critical. Market conditions often change. When selecting the time period, it's important to make sure that you avoid using historic price data that has nothing to do with the way the markets are moving today. Ideally, you want your backtesting time period to be as recent as possible to produce reliable results.

Start Trading in 10 Minutes

Apply everything you’ve learnt on a real trading account with up to 1:2000 leverage, negative balance protection and outstanding support.
Get Started

How to backtest on other popular trading platforms

Now, let’s explore the process of backtesting trading strategies using various widely used trading platforms. Backtesting plays a pivotal role in the development and enhancement of profitable trading strategies. 

How to backtest on MetaTrader 5 (MT5)

MT5 offers an enhanced strategy tester to its users. The main difference between MT4 and MT5 strategy testers is that on MT5 traders can use the tester for multi-currency backtesting., making it easier and efficient to test trading strategies across different financial instruments. Furthermore, MT4 uses MQL4 coding language, and MetaTrader 5 uses MQL5. The MQL5 enables traders to create and backtest more complex trading strategies.

It takes a couple of steps to automatically backtest Expert Advisors (EAs) on MT5. First, traders need to open the trading platform for their desktop.

  • Step 1: expand “View” tab and click on the “Strategy Tester” 
  • Step 2:From the “Overview” section select “Single”, “Visualize”, or “Stress & Delays”. Single - helps to backtest the Expert Advisors with basic settings. Visualize - uses visual mode to perform backtesting while the process is shown on the chart. Stress & Delays - performs backtesting by delaying execution and generating slippage, in other words, this option shows traders how their strategy will perform under stress. 
  • Step 3: Click on the “Settings” tab located right next to “Overview” to set the conditions for backtesting. From this window traders need to select specifications such as EA, trading symbol, timeframe, date, leverage, etc. 
  • Step 4: Once the settings parameters are done, open the “Inputs” window located right next to the “Settings” tab. From this window you can set the parameters for the EAs. The Expert Advisor program initially displays default values, yet you have the flexibility to customize them as needed. The adjustable parameters differ across EAs, encompassing options such as Take Profit (TP), Stop Loss (SL), trade timing, and various technical indicators employed within the EA program. 
  • Step 5: press “Start” to kickstart the backtesting process. 
  • Step 6: The outcome of the backtest will be presented in the “Backtest” tab. Additionally, in the “Graph” tab, you can visually track the evolution of the account balance and equity, represented by the blue and green lines, respectively. 

How to backtest on cTrader

cTrader employs the cAlgo (C#) coding language for creating trading robots known as cBots. These cBots are remarkably versatile, offering complete customization to execute a spectrum of trading actions triggered by specific market movements and events. Notably, it’s worth mentioning that cAlgo is recognized for its simplicity compared to MT5’s MQL5. 

There are a couple of stages traders need to go through to successful test their trading strategies on cTrader platform

Step 1: To initiate backtesting, begin by selecting the specific cBot instance you wish to evaluate. Locate the series of tabs positioned just below the upper UI bar, which includes the “Back” button. The initial tab displays the trading chart associated with the currently selected instance. The “Backtesting” tab should be placed to its right. Simply click on it to transition to the dedicated backtesting area.

mt4 backtesting guide

Step 2: Select the period for backtesting. Backtesting allows you to simulate the performance of a cBot instance using historical market data. You are afforded various options to precisely specify the timeframe for which the backtesting process should be conducted. Keep in mind that determining the perfect time period to analyze is very difficult, the more information you feed your algorithms with doesn’t always translate into better results. Market conditions often change and studying old market information might be irrelevant for today’s market movements. 

To set the time parameters you can use the slider. The calendar slider is positioned near the upper section of the “Backtesting” tab. Set both gray points along the slider to define the data range for the upcoming backtesting session. Additionally, you have the option to select an exact date range using the calendar drop-down menus situated to the left and right of the slider. 

Step 3: configure backtesting settings. Prior to initiating a backtest, click on the “Cog” icon located just to the left of the leftmost calendar menu. The backtesting settings section will open, where you can configure important settings. 

  • In the “Starting Capital” field, input the initial funds with which your cBot will commence its operations. 
  • Navigate to the “Commission” menu and choose (or type) the commission that your cBot will incur after trading a million units in volume. 
  • Within the “Data” menu, configure the historical data source for backtesting. Typically , opting for M1 data from the server strikes a balance between accuracy and the computational demands of backtesting. It’s important to note that you also have the option to upload custom data from a locally stored .CSV file. 
  • Select either fixed or random spreads within the “Spreads” sub-section. If opting for a fixed spread, click on “Live” to align it with the current spread of the selected symbol. 

You have the option to observe the backtesting process in real-time, or you can choose to disable the “Visual Mode” flag. If the flag is turned off, rather than witnessing the backtesting in real-time, you will receive a comprehensive report summarizing the results once the process concludes. 

To initiate a backtest with the specified settings and chosen mode, click on the “Play” button positioned to the right of the rightmost calendar menu. cTrader Automate will start loading the chosen historic data. The duration of this process may vary, taking several minutes based on the selected period and the hardware on which cTrader is running. 

And finally, check the results of backtesting. Various methods are available for assessing the results of backtesting. Upon completion of the backtesting process, the number displayed at the center-top of the trading chart will provide a concise summary of the total net profit generated by your cBot.

An alternative method to assess your cBot’s performance is to navigate to the “Equity” tab within the trade panel located just beneath the trade shart. Here, you’ll encounter a chart depicting the total number of traders on the X-axis and funds on the Y-axis. The yellow line traces your cBot’s balance, while the gray line charts its equity over time. 

Trying out your cBot with backtesting is a smart way to check if it’s doing what you want. By looking at detailed stats and the equity chart, you can figure out when your robot did well or not-so-great. Plus, backtesting lets you change things up a lot, so you can train your bots in all sorts of situations.

MT4 backtesting tutorial – Key takeaways

Using a method called backtesting, traders can examine the effectiveness of their trading strategies. If a certain strategy brings virtual payouts for the historical market conditions, traders will get the impression that the same strategy could actually work in real life.
 
When it comes to conducting backtesting on MetaTrader 4, there are certain precautions traders have to take beforehand. For example, they have to download appropriate historical data for their specific instrument. This data will be used for testing out the trading strategy.
 
After the precautions, traders will have to choose a specific element they want to backtest. In our guide, we focused on backtesting Expert Advisors. In the same Strategy Testing window, they also need to select their trading symbols, backtesting model, as well as a timeframe and specific spread amount.

Finally, traders will have to enter the amount they want to trade and start backtesting on MT4. The outcome of this process will be visible in the Results tab, where traders will be able to see whether their strategy would have been successful in the past or not.
 

FAQ on how to perform backtesting on MetaTrader 4

Why do traders use backtesting MT4?

Backtesting is predominantly used in order to determine the effectiveness of the given trading strategy. While traders cannot do that in real life, the ability to simulate certain positions on past economic data can help them achieve more or less the same effect.

So, if the backtesting results show that the current trading strategy would bring payouts in the past, this would give traders more incentive to use that same strategy in real life.

But if the results were negative, meaning the results produced losses, traders would be more discouraged from using that strategy in real life. Of course, these conclusions are still speculative, as predicting market conditions at 100% is pretty much impossible.
 

Which elements can traders use to backtest on MetaTrader 4?

There are various elements that can be backtested on MT4. On stock, the software offers two elements – Expert Advisors and indicators – that are available for automatic backtesting. 

While we provided information about the EA backtesting, this method also works for indicators pretty much the same way. After entering all the necessary prerequisites, the software will backtest the indicators automatically.

But this doesn’t mean that traders cannot test out their own strategies manually. They can certainly do that, but it will take more time and includes a lot more steps than the automatic backtesting. 
 

What steps do I need to take before running the MT4 strategy tester?

Before jumping right into backtesting a trading strategy, you need to make sure you have taken several steps. First things first, you need to enable the Strategy Tester feature in MT4. You can do that by heading to the View menu and selecting the feature.

After that, you need to have appropriate historical data for your specific trading symbol. Usually, MetaTrader 4 doesn’t offer full market data for every instrument, which means backtesting won’t be as accurate as it should be.


To avoid that, you may manually download data to your platform. But it’s not as complicated as it sounds: you can go to the Tools menu and select History Center. There, you need to choose your own symbol, double-click it, and once the appropriate data is visible, import it to the system. These two steps will give you the basic playground for backtesting your trading strategies.

How to backtest on MT4 android

Mobile trading apps are a great tool for keeping in touch with the markets. It can help you close orders in case of emergency power outage, bad internet connection, etc. A mobile version of your trading platform is an absolute must-have when starting out trading. However, making major decisions or backtesting strategies using your phone is a bad idea. If you treat trading as running a business and not as gambling, you should have a large enough screen to thoroughly analyze markets, backtest strategies and trade. Backtesting using android devices is done using backtesting trading apps that can be found in your Play Store. The apps can be installed similarly to any other app.

What is strategy tester MT4?

Strategy tester is a MetaTrader 4 platform tool that helps traders test their trading algorithms. The strategy tester uses historic price data to get clues on how a given algorithm would perform in a given period of time on a predetermined market. The fact that the testing is done using historical data, makes the whole process much less time-consuming than in the case of demo trading.
Axiory uses cookies to improve your browsing experience. You can click Accept or continue browsing to consent to cookies usage. Please read our Cookie Policy to learn more.