The backtesting tools of MetaTrader 4 serve for testing and defining the trading parameters of the Expert Advisors. In this way the trading behaviours of each EA for any period of time - as long as historic rates are available - can be simulated and the tools allow an analysis of the impact of different parameter changes.
The working method of backtesting needs to be understood before evaluating the test results. In principal historic rate information is based only on minutes and not on individual ticks. This may lead to the generation of buy or sell signals or trigger take profit or stop loss limits in live trading, - in particular when the market movements are very volatile -, notwithstanding the fact that this should not have happened according to the results of subsequent backtesting with identical parameters.
Moreover, only historic bid prices are available for backtesting, ask prices have to be identified based on the prevailing spreads at the point of testing. This implies that the particular instant of time may influence the result of the test. For this reason, it is recommended that Expert Advisors are always tested during trading times. As the spreads usually extend in the last minutes of trading and the spread last registered will be used for tests carried out during weekends, the testing results may be significantly distorted. If an expert advisor is tailored for a specific trading window like the Asian session, tests during this particular time period should be carried out.
Once the final date of a testing period is reached, the strategy tester will close all open positions. In this case a possibly existing drawdown may be completely realized independently of the respective Expert Advisor's trading strategy. Please bear this in mind when evaluating the test results.
Reversely, this implies that on basis of the backtesting results a general trend expected from each Expert Advisor's performance can be derived, however, precise results cannot be forecast. The findings obtained through backtesting should be verified in a testing phase on a demo account.
MetaTrader 4 uses the smallest rate unit available for the the given backtesting situation. It is recommended that rates on a per minute basis should be downloaded completely in order to avoid a further deterioration of the tests' accuracy. Download in MetaTrader 4 History Center (Tools --> History Center or F2) where individual time frames for all currency pairs are available.
15 MB data will be transferred for each currency pair for the M1 time frame, this requires some 200 MB disk space after processing by MetaTrader 4, time frames at a higher level will be computed automatically. Gaps in the rate information of the preceding 2-3 months occur regularly due to a software bug. For this reason some FX brokers offer the possibility to download the rate information, the data can be imported from the History Center.
Parameters for individual tests are captured in the MetaTrader 4 Strategy Tester (View --> Strategy Tester or Strg+R). The time frame has to be defined after the selection of the Expert Advisor and the currency pair to be tested. The model "Every tick " should be chosen in any case, as other methods usually do not deliver useful results. The time period to be monitored can be defined in the function "Use Date", a testing period of 6 months should be adequate for a rough adjustment of the trading parameters. The "Visual Mode" is suitable for the analysis of an individual trading day.
Trading parameters are being set in "Expert Properties", the function "Testing" caters for the entry of the original amount and account currency. Additionally, the direction of the Expert Advisor can be specified - long only, short only, or both directions.
The menu "Inputs" lists all EA-specific trading parameters, for the time being the column "Value" is of further interest. Usually you will find a description of the parameters in the manual of the respective Expert Advisor. The function "Reset" permits a reset of all parameters back to their original values.
The testing itself requires a few minutes depending on the selected time period and the complexity of the Expert Advisor, it may take several hours if longer time periods are evaluated. Individual orders can already be tracked in "Results" or "Graph" while the computations are still on their way, a summary is available in "Report" upon completion of the simulation. Please pay special attention to the values for "Modelling Quality" (Target: 90%) and Mismatched Chart Errors (Target: 0). In case of a deviation of these values, the historic exchange rate data is faulty and requires a repeat of the computation or a completely new download.
MetaTrader 4 Strategy Tester offers the possibility to simulate selected parameters within a predefined range in order to simplify experiments with different trading parameters. The columns "Star", "Step" and "Stop" within "Expert Properties" are being used for this feature. The values as defined in this section will be taken into account only for parameters with an active tick in the check box on the very left. Furthermore, it requires the selection "Optimization" in the main display of the Strategy Tester. The results will be shown in "Optimization Results".
If possible, 2 or 3 trading parameters should be optimized simultaneously, otherwise the number of iterations will be increased significantly. Initially, it may be a good idea to carry out a rough optimization, e.g. a run in steps of tens of the take profit limits from 10 to 50 pips and the stop loss limits from 10 to 100 pips. However, even a simulation of 50 combinations as in the above described rough optimization may take several hours when using a complex EA. Afterwards the parameters between the two best results can be optimized in a second step, for example a stop loss limit with 60 pips and take profit limits from 10 to 20 pips.
Comment: By default, negative optimization results will not be displayed. In case this display is needed for comparative purposes, the default can be deactivated by a right click on the optimization results and by deselecting "Skip Useless Results". The change will affect only future test runs, results already automatically deleted cannot be recovered.
Many Expert Advisors use a GMT Offset function for time alignments, specifically when they are active only at certain trading times. Please note that the automatic determination of GMT offset does not function in backtesting. Usually the function "Auto GMT Offset" of the selected Expert Advisor needs to be deactivated and/or the required parameter needs to be entered manually for the purpose of backtesting. Summer and winter times depending on the location of the broker must be set correctly, otherwise the simulation or optimization using wrong GMT Offsets will cause faulty results. Hence, at least 4 test runs (summer/winter time for the first year and summer/winter time for the second year) are necessary.
Some brokers use servers with an all-the-year setting of GMT +/- 0. Backtests executed onMetaTrader 4 installations of this type of broker do not require an adjustment of the trading hours during the year or the GMT Offsets.
Most key figures listed in the results are self-explanatory, however, some of the more important ones will be explained below:
Um Backtests mit einer Genauigkeit von 99% durchführen zu können, sind entsprechende historische Daten erforderlich. Um diese Daten herunterzuladen und aufzubereiten kann Birt's Tick Data Suite verwendet werden. Die Suite ist mit einer kostenlosen siebentägigen Probezeit für USD 97,- erhältlich, der Support kostet monatlich USD 10,-. Die Kaufabwicklung erfolgt über Clickbank.
Deutsch / English