Trading Strategy Tester

Test and optimize your trading robot before you use it for real trading

The built-in MetaTrader 5 Strategy Tester facilitates the testing of automated robot performance in trading. This powerful tool not only allows testing the efficiency of an Expert Advisor, but also allows detecting the best input parameters before you run the EA on your real account.

The entire operation of the Strategy Tester is based on historical quotes of currencies, stocks and other assets. During testing, the Expert Advisor goes through the accumulated quotes and performs virtual transactions according to its algorithm. This procedure allows an evaluation of how the EA would have traded in the past.

Setup of Expert Advisor testing in the Strategy Tester

The MetaTrader 5 Strategy Tester allows testing Expert Advisors on multiple currencies. Trading robots 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 chart of testing results in the Strategy Tester

The main advantage of the testing procedure is the possibility to evaluate a robot performance prior to trading on a real account. In addition, it takes only a few minutes in the tester rather than days, weeks or months needed to test an EA in the real market. This is an indisputable advantage of the Strategy Tester, but not all of its capabilities.

Testing modes

MetaTrader 5 Strategy Tester offers several testing modes to achieve the optimal speed/quality ratio based on trader's 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 traders who want to test a strategy quickly but also accurately at the same time. Select "Open prices only" if you need very quick and rough estimation based on bars' open prices.

The Strategy Tester is not only used for the testing of the trading robots, but it is also used to solve many mathematical problems involving parameter optimization. In this case trading history is not used and the market environment is not simulated giving way to math calculations implemented in the Expert Advisor.

With stress testing, the testing of trading robots can be 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. The results are shown in figures displaying an Expert Advisor's profit during a test. Additionally, 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.

Strategies testing results can be presented in charts for more convenient analysis.

The charts of testing results in the Strategy Tester

Visual testing

Visual testing makes it possible to track an Expert Advisor's operations on historical price data in real time:

Visual testing of Expert Advisors in MetaTrader 5

All performed deals are visualized on a chart, which makes the analysis more convenient. The testing process can be slowed down or stopped to observe how trading is performed at any particular time interval.

The visualization mode allows the trader not only to monitor the trading robot's operation in real time, but it additionally allows the testing of custom technical indicators. For example, you can evaluate an indicator's behavior on historical data before buying it from the Market.

Optimization

Another important utility of the Strategy Tester is the function of optimization, which allows choosing the best input parameters for a specific trading robot. For instance, with optimization, you can modify the parameters to achieve maximum profitability and stability, minimum risk and so forth.

Optimization parameters for a trading robot in the Strategy Tester

During the optimization process, one trading robot is tested multiple times with different sets of parameters. After the optimization, you can compare the results to select the parameters that provide the best performance for your robot.

The number of combinations of input parameters in the optimization can be overwhelming: you can have up to hundreds or even thousands of such combinations. As a result, the optimization can turn into a very extensive process, but still can be significantly shortened through the use of genetic algorithms. This feature disables the serial search of all combinations of input parameters and selects only those that best meet the optimization criteria set. In subsequent phases, the "optimal" combinations are crossed until the best possible result is achieved. The genetic algorithms help to considerably reduce the number of combinations and the total optimization time.

Graphical display of optimization results

The Strategy Tester provides powerful 2D and 3D tools for visual analysis of optimization results. For example, you can analyze correlation of a final result with two parameters in 2D, while 3D allows you to view the entire process of the optimal result search during optimization.

Optimization results in the 2D and 3D modes in the Strategy Tester

In addition to the built-in features, you can use custom visualization methods. There is no need to prepare data in some specific way, export it or process in a third-party application. Results can be reviewed during the optimization process.

Forward testing

The forward testing option helps avoid the so-called "over-optimization" or parameter fitting.

The built-in forward testing option helps avoid the problem of "over-optimization" or parameter fitting. This option divides the database of currency and stock quotes for optimization into two separate parts. The optimization is performed for the first part, while the second part is used to confirm the obtained results. If a trading robot is equally efficient on both segments, this is the proof that the trading system has the best parameters, and parameter fitting is practically impossible.

MQL5 Cloud Network

Distributed testing and optimization allows the connection of additional computing resources in order to enhance these processes. For example, you can use additional computers in your local network to accelerate the optimization process. But that is not all.

MQL5 Cloud Network is a cloud computing network that unites thousands of computers from all over the world. The Strategy Tester can connect to the network benefiting from almost unlimited computing power. With the MQL5 Cloud Network, the optimization of trading applications, which would normally take months to compute if using only one computer, can now be completed within a few hours.

Use of the MQL5 Cloud Network in the Strategy Tester

MQL5 Cloud Network can be enabled through the MetaTrader 5 trading platform in just a couple of clicks. Learn more about how MQL5 Cloud Network can accelerate calculations >>

In addition to using the distributed computing network, you can provide your CPU computing power and earn money. You should launch the MetaTester component included into the MetaTrader 5 trading platform and your computer will be connected to the MQL5 Cloud Network.

The Strategy Tester is an extraordinary powerful tool crafted for developers of trading robots. Without the use of the tester, the creation of an efficient and reliable robot is practically impossible. The Strategy Tester saves you lots of time and allows creating a truly optimal trading robot!

Download MetaTrader 5 and test your robot in the Strategy Tester