You probably know that when you develop or purchase a new Expert Advisor, the first thing you have to do is to test it. Then if the test was successful you can run EA on a live account. The testing process can be divided into two parts back-testing and forward testing. Forward testing means trading on the demo account and it is performed when back-testing achieved satisfactory results. On the other hand, back-testing refers to testing using historical data. It gives you a good initial picture of your EA and about its performance over various trading instruments. So how can you back-test, what is the proper way?

There are many different tools available for back-testing. MetaTrader 4 and other trading platforms have this feature built-in. Forex Tester 4 is a separate application that is created only for the back-testing process. EA building tools usually support this functionality. Alternatively, you can back-test manually using excel.

EA Backtesting

Since it is a process that measures trading strategy performance using historical data, you have to get those necessary data first. MetaTrader automatically downloads some data. However, to improve the testing quality you should download it either from your broker or form trading platform repository. To do so, go to Options – Historical Center and download the data for all trading instruments that you will use for testing. A parameter that measures the quality of historical data is called modeling quality. To consider the back-testing process relevant it has to be at least 90%.

Strategy Tester window

MetaTrader tool for back-testing is Strategy Tester. To perform the process you have to select the EA you want to back-test, trading instrument, time-frame, start and end of the period. You can check visual mode and you will be able to see the trading process as it is in real-time. Though it is sometimes nice and useful to see how it performs, it is slowing down the testing. Under expert properties, you can select account starting balance and all EA’s entry parameters. Symbol properties will reveal important parameters about the trading instrument such as spread, swap, minimum stop level, and contract size. As spread can vary during the day you have a possibility to select it during the testing period.

Strategy Tester Report

After setting the parameters you can start the process by pressing the Start button. Depending on the period, the complexity of the robot and testing mode the process can last from a few seconds to several minutes. When it is completed, a result section will show you every trade taken by the robot. The graph section will show balance and draw-down levels after every trade. The report will summarize the experts’ trading performance. You will see the profit, draw-dawns, number of wins and losses, number of longs and shorts and many other interesting parameters.

EA Optimization

Optimization is a process of finding the most ideal set of EA’s entry parameters. Strategy Tester supports the optimization process, it compares the profits using different entry parameters. To initiate optimization you have to check the Optimization box. In the Expert properties set a start value, an end value and step for every entry parameter. Do not enter too many combinations because in that case, the process can last for several hours. It is always better to repeat the process several times by entering a smaller number of combinations. For each set of parameters, you will find out what is the net profit, profit factor, and maximal drawdown. After you have to find the optimal set op parameters back-test it once again to check the results.

However, keep in mind that for the same robot one set of parameters will yield the best results in one period while in a different period the other set of parameters will give you the best results. It is impossible to find the perfect setup however, the mechanism will give you a good idea of what is better.

Final Thoughts

So, back-testing is a process of testing the expert advisor’s performance using historical data for the selected trading instrument. It gives you the idea about the robot performance. Almost every trading platform that supports automated trading offers functionality. It can be also found in EA building tools and there are separate back-testing and optimization applications. Optimization is a mechanism of finding the optimal set of EA entry parameters.


Leave a Reply

5  +  2  =