How to Backtest an Expert Advisor in Metatrader

Forex traders need to improve and adjust their trading strategies every day to earn more profit through buying or selling, and it is a good idea to learn from past experiences. This is the basic idea of backtesting, which is a way of estimating the performance of a strategy or an Expert Advisor as if it had been incorporated in the past. To do this, you need high-quality historical data in detail. Then, you can run the strategy on the financial instrument of your choice. Traders can backtest an Expert Advisor on Metatrader to see if it is one of the best forex expert advisors. As a trader, you must know how to backtest if you want to avoid losses, so, here are the hints of backtesting with Metatrader 4, which is an independent web-based backtesting platform.

 

Information You Can Obtain From Backtesting

When a trader backtests a Forex Expert Advisor, he can get to see the historical data in the chart, which includes:

  • Entries for the traders
  • Exits for the traders
  • The exact time of the execution of the orders
  • Trades that were dealt with the strategy

 

The Importance of Using A Demo Account in The Beginning

It is best to backtest the expert advisors on demo account because there is no guarantee that you will continue the performance. After backtesting, if you like the performance, only then you should try it on the live account. Keep in mind that in forex trading, you need to take risks and own responsibility, so, it is always better to be cautious.

 

Backtesting on Metatrader 4

Choose an Expert Advisor: To backtest, the first thing you need to do is getting yourself an Expert Advisor. You may learn to code them, or you can also buy one from a trusted provider.

Open Strategy Tester Panel: When the Expert Advisor is ready, click on View, and select Strategy Tester. By doing this, the Strategy Tester panel is opened. The panel appears at the bottom of the Metatrader platform.

Now, you need to follow these seven steps to backtest Forex Expert Advisors on Metatrader 4:

  1. Select the Expert Advisor chosen by you from the list called “Expert Advisor” in the field.
  2. Next, go to the “Symbol” field and choose the financial symbol from there. From the field called “Period”, you can choose the timeframe that you want to backtest your strategy with. Keep in mind to load historical data for your chosen symbol before proceeding.
  3. Now, you need to choose the Model Value. Based on your needs, there are three possibilities:
  • Every tick: It allows you to have a more accurate backtest. However, it is slow because Metatrader starts from the opening price to the closing one and reads open, high, and low close prices from the historical dataset. Thus, random prices are generated inside each candlestick.
  • Open close only: If the strategy you follow is a middle term one where you are not concerned about movements within the single candlestick, and you do not need the reading of high and low prices, then it is a good parameter for running backtests. This is a fast method and it is ideal if running multiple tests for optimisation is required.
  • Control points: It is not a very good method because the nearest less timeframe is the base of it. It would be better not to use it.
  1. According to your broker fees, select the “Spread”. It is wise to backtest with two times bigger spreads than the ones need to be paid to the broker. Always backtest in the worst-case scenario. You can select “Current” from the Spread field to know this information.
  2. Refrain from flagging the field “Use date” as it reduces the backtesting date range. Running “Walk forward analysis” and avoiding “Overfitting” is more useful for optimisations.
  3. The “Optimisation” button must not be flagged either because the backtest is running for the first time. Instead, it is better to optimise the strategy later.
  4. Now that everything is in the right order, click on the “Start” button to run the backtest.

In a few moments, a graph will appear, and you can view the results there to know the past performances of the strategy.

The views expressed in this article are those of the authors and do not necessarily reflect the views or policies of The World Financial Review.