Welcome
Your Expert Advisor is finally completed. Now it's time to debug, backtest, and optimize your
EA for the Forex Market to earn some profits.
"Testing and optimizing Expert Advisors in MetaTrader is not a challenge anymore!"
|
Strategy Testing of Expert Advisors in MetaTrader MT4
Your Expert Advisor has been written. It is at this point that a very important stage begins: the
expert must be debugged and optimized for the market to earn profits. Testing on historical data
is an essential prerequisite for a profitable automated trading system to be created. Every trader
knows that manual testing of the Expert Advisor is a quite labour-intensive and long process. This
is why many traders use special software tools for testing.
A visual strategy tester is embedded in the MetaTrader (MT4)
Client Terminal along with the MetaQuotes Programming Language (MQL4).
Testing and optimization of expert advisors is not a challenge anymore!
The first expert advisor strategy tester appeared in the online trading platform MetaQuotes as far
back as 2002. Since then MetaQuotes has gained much experience: created two new online trading platforms
MetaTrader 3 and MetaTrader 4, with MetaTrader 5 coming shortly, and developed the expert advisor strategy
tester with visual testing.
Advantages of the Expert Advisor Strategy Tester
-
Flexible test settings: Any optimizable parameter of the expert - balance, profit factor, maximal drawdown - and
any timeframe (if historical data is available) can be tested.
-
Reports about testing results: For better and quicker analysis of experts' test and optimization results, different kinds
of reports are embedded in the strategy tester. The graphic display of test results demonstrates
balance changes during expert testing. It is always possible to analyze each specific trade
separately, if necessary.
Besides, a combined report is generated after each test. It includes a mass of statistical
data about testing parameters and trading activities of the expert. Any desired parameters,
starting with the quality of the modeled history and finishing with the expected profit in
the next trade (mathematical expectation), can be found there.
The possibility to monitor tester work by logs from journal is provided, as well.
-
Visualization of strategy testing: Visualization allows monitoring of the expert testing process. One can see directly in the
chart how the automated trading system trades. All this makes it possible to implement advanced
standards in testing of Expert Advisors and to analyze the expert's behavior more precisely.
-
Use of genetic algorithms in testing: The idea of genetic algorithms was borrowed from animate nature and consists in artificial
construction of the evolutionary process. The ultimate goal of this process is to find optimal
solution for a complicated problem. Genetic algorithms enable quick and effective search of a
huge amount of combinations during expert optimization. Use of genetic algorithms saves
optimization time for automated trading systems by hundreds or even thousands of times.
-
Different modes of bars modeling: For testing to be precise, tick data is required. But it is often impossible to get tick-by-tick
history for a sequence of years. Traders, as a rule, have only one-minute data available. This is
why there are three modes of bars modeling available in the strategy tester.
The choice of the bars modeling mode essentially influences the adequacy of the expert test and
optimization results. Thus, one can quickly test the expert using the fastest mode of modeling on
historical data. However, the testing error can be rather significant. At every-tick modeling, in
fact, the large amount of data to be processed takes much more time. But the results will be more
precise and reliable.
All the above advantages of the visual strategy tester enable the trader to optimize their automated
trading strategy to meet market requirements. Benefit from the visual strategy tester and maximize
your profits. No matter whether you are going to automate your trading system or not, it must be
tested and optimized!
Here are the three modes of bars modeling available
-
Open Price - some traders do not wish to depend on particluarities of intrabar modeling,
so they create Expert Advisors trading on the bars already completed. The fact that the current
price bar is fully completed can only be known when the next one appears. These are the Expert
Advisors, for which the mode of "Open Price" modeling is intended. In this mode, first, bar is
opened (Open = High = Low = Close, Volume=1), and this allows the Expert Advisor to identify the
end of completion of the preceding price bar. It is this incipient bar, on which the Expert
Advisor's testing is launched. At the next stage, the current bar fully completed is yielded,
but no testing is performed on it!
-
Control Points - method of modeling control points is intended for crude estimate of
Expert Advisors trading within a bar. To use this method, historical data of the nearest less
timeframe must be available. In the some cases, the data available from a smaller timeframe
do not completely cover the time span of the timeframe under test. If there are no data of
a smaller timeframe, the bar evolution is generated on basis of predefined wave templates,
as it was the case in the preceding third version of MetaTrader 3 Client Terminal.
As soon as historical data of the less timeframe appear, these are these data that are
interpolated. However, the really existing OHLC prices of the less timeframe appear as
control points. In the most cases, the results of tests of Expert Advisors by method of
control points can be considered as estimated results only, not as final ones. Such results
are of intermediate, estimated nature. The chart below shows how the on-hour bar of
2007.09.05 10:00 developed by method of control points.
-
Every Tick - this mode allows to model price movement within a bar in the most
precise way. Unlike "control points", the every-tick method uses for generation not only
data of the nearest smaller timeframe, but also those of all available smaller timeframes.
At that, if there are data of more than one timeframe for a certain time span available
simultaneously, the data of the smaller timeframe are used for generation. Like the
preceding method, this method generates control points based on the OHLC data of the
smallest available timframe. To generate price movements between control points,
interpolation based on the predefined templates is used, too, so the availability of
one-minute data that cover the entire testing range is extremely desirable. It may
happen that several identical ticks are generated one after another. In this case,
duplicated quotes are filtered out, and the volume of the last one of such successive
quotes is fixed.
|