Forex Strategy Tester in the MetaTrader 5 Trading Platform
To test how an Expert Advisor (Trading robot) can perform in trading, the built-in Strategy Tester is available in MetaTrader 5 Trading Platform. This powerful tool allows testing the efficiency of an Expert Advisor and detects the best input parameters before it is used for real trading on the Forex or Stock Markets.
The entire operation of the Strategy Tester is based on historical data of the financial instrument. During testing, the Expert Advisor goes through the accumulated quotes and analyzes them one by one. At the same time the trading robot performs virtual transactions in accordance to its trading algorithm. This allows simulation of the price dynamics and assess how the robot would have traded in the past.
The MetaTrader 5 Strategy Tester allows testing trading robots on multiple currencies. Expert Advisors have access to all the financial instruments in the tester and can perform trading transactions with any of them. This feature allows you to test even more sophisticated Expert Advisors that are capable of analyzing multiple currencies and identify the correlation between them.
The main advantage of testing is the possibility to evaluate a robot performance prior to trading on a real forex account. In addition, it takes only a few minutes in the tester rather than days, weeks or months needed to test an trading robot in the real market. This is an indisputable advantage of the Strategy Tester, but not all of its capabilities.
MetaTrader 5 Strategy Tester offers several testing modes providing the optimal speed/quality ratio according to traders' needs. "Every tick" is used to ensure the best testing accuracy. Simulated conditions are the most realistic in this mode. "1 minute OHLC" is introduced for those who want to test a strategy quickly but accurately enough. Select "Open prices only" if you need very quick and rough estimation or your forex trading strategy is based only on bars' open prices.
Strategy Tester application areas are not limited only to testing trading robots. It can also be used to solve many math problems involving parameters' optimization. In this case trading history is not used and the market environment is not simulated giving way to math calculations implemented in an Expert Advisor.
Stress testing makes testing trading robots even more realistic. Random Delay mode simulates network delays when transferring and processing trading requests, as well as delays of requests' execution by dealers in real trading.
Graphical Display of Test Results
Display of Expert Advisors' test results is one of the most notable features of the Strategy Tester. Results are shown not only in figures displaying an Expert Advisor's profit during a test. They are also represented by a great amount of statistical data including profit/loss percentage ratio, number of profitable/loss-making deals, risk factor, expected payoff and much more.
Results of testing strategies are also presented in charts making strategy analysis even more convenient.
Extensive information on results of testing strategies for Forex and other markets provides vast opportunities for trading robots' developers. However, nothing can replace live monitoring of an Expert Advisor's trading. Visual testing makes it possible to track Expert Advisor's operation on historical price data in real time:
All performed deals are displayed on a chart simplifying their analysis. Testing process can be slowed down or stopped to see how trading is performed at any particular time interval.
Visualization mode allows you not only to see your trading robot's operation in real time. It can also test custom technical indicators. For example, a trader can evaluate an indicator's behavior on historical data before buying it via Market.
Another important utility of the Strategy Tester is the function of optimization, which allows choosing the best input parameters for a specific Expert Advisor. For example, with optimization, you can modify the parameters to achieve maximum profitability, maximum stability, minimum risk and so on.
During the optimization process one Expert Advisor is tested multiple times with different sets of parameters. After optimization, comparison of the results of all tests is possible, which allows selecting the parameters that provide the best performance of a trading robot.
The number of combinations of input parameters in the optimization can be quite large, up to hundreds or even thousands. As a result, the optimization of Expert Advisor can turn into a very extensive process, but still can be significantly shortened.
Forex Strategy Tester supports genetic algorithms. This feature disables the serial search of all combinations of input parameters and selects only those that best meet the optimization criteria. In subsequent phases, the "optimal" combinations are crossed until the results stop improving. Thus, the number of combinations and the total optimization time are considerably reduced.
Single Trading Strategy for Multiple Symbols
Strategy Tester for Forex and other markets allows you not only to find best trading robot's parameters for any specific financial instrument. Any strategy can be automatically tested on all symbols available in Market Watch at one pass by clicking "Start" button.
Obtained statistical test data on each symbol will be displayed as a table in "Optimization Results" tab. You will be able to launch a single testing of any symbol from the table by double clicking on it. Thus, this optimization mode allows you to quickly test all Market Watch symbols on one trading robot, determine the best results and analyze their change depending on a symbol.
MQL5 Cloud Network
Distributed testing and optimization allow adding more computing power to these processes. For example, you can use computers in your local network and accelerate the optimization process by several times. But that is not all.
MQL5 Cloud Network is a cloud calculations network that unites thousands of computers from all over the world. The Strategy Tester can connect the network benefiting from its almost unlimited computing power. Thus, the optimization, which would take months if using only one computer, can now be run in a few hours.
MQL5 Cloud Network can be enabled in MetaTrader 5 trading platform in two clicks. Learn more about how to speed up calculations with the MQL5 Cloud Network.
In addition to using the distributed computing network, traders can provide their CPU computing power and earn money. To do this, launch MetaTester component included in MetaTrader 5 trading platform. It will connect your computer to MQL5 Cloud Network quickly and conveniently.
Graphical Display of Optimization Results
The Strategy Tester provides powerful tools for visual analysis of optimization results that can be displayed in a chart, as well as in 2D and 3D.
For example, you can analyze a correlation of a final result with two parameters in 2D.
3D allows you to see the entire process of searching the best result during optimization. Example of searching for the function maximum using the math calculations mode in the Strategy Tester is shown below:
In addition to the built-in features, traders can easily use custom visualization methods. There is no need to prepare data in some specific way, export and process it in a third-party application. Results can be displayed right during the optimization process.
Built-In and Custom Optimization Criteria
What is the best set of parameters in each optimization case? Maximum profit can be used as the main criterion. However, it does not ensure objective evaluation of a trading robot in all cases. Analysis of complex indices can prove to be more efficient. The Strategy Tester offers many useful tools for that case providing 6 built-in optimization criteria considering balance, drawdown, profitability, etc. The main feature is the use of custom optimization criteria. Traders can implement any parameter into their Expert Advisor to test it in the Strategy Tester.
The built-in forward testing helps avoid the insidious problem, which is usually called "over-optimization" or Expert Advisor parameter fitting. This option divides the quotes history base for optimization into two parts. The optimization is performed for the first part, while the second part is used to confirm the obtained results. If Expert Advisor is equally efficient on both segments, this is the proof that the robot has the best parameters and parameter fitting is practically impossible.
The Strategy Tester is an indispensable tool for developers of Expert Advisors. It is practically impossible to create an efficient and reliable trading robot without this exciting tool. The tester saves lots of time and allows creating a truly profitable Expert Advisor.
MetaTrader 5 — a complex trading platform for providing brokerage services on the retail Forex market.
Copyright 2000-2013, MetaQuotes Software Corp.