- Forex Books
- Forex Journals
- create content
- recent posts
- Downloads
MetaTrader Strategy Tester
Submitted by codersguru on Fri,
2006-02-17 16:33.
When you step into the playground it's the game time where there's no
place to test, to mistake or to learn.
When you go live trading you
can't undo your steps back by clicking CTRL+Z and saying:
"I'm awfully
sorry, I'll not do it again". No mercy.
That's why the most of traders spend months and even years testing thier strategies before going to the show.
How to test your strategy?
You've bought the strategy your best friends has told you it'll make
you one of the 100 richest forex players by the next summer. Or maybe you
have downloaded one of heavily discussed strategies from a forex forum,
Or maybe you have red my
target=_blank>lessons carefully and successfully wrote your strategy
(I hope).
Anyhow, it's the suitable time to test your strategies before
going live trading.
There are two ways to test your strategy; forward testing and back testing:
Forward testing:
Forward means you test your strategy on the future market prices not the history data. In this method you test your strategy in a demo account day by day for a sufficient period before you decide is it a successful or not a successful strategy.
It’s more accurate method than the back testing but it may take months and even years from you to get assured results and it requires a comfortable seat in front of your computer all the day.
Back testing:
Back means you test your strategy on the history market data not the future ones. In the method you run the MetaTrader a built-in feature called Strategy Tester which enables you to test your strategy against the already saved history data.
It’s a less accurate method but it takes minutes from you to determine was it a good or bad strategy.
Back testing debates:
The back testing accuracy issue has been heavily debated between the MetaTrader fans. Those fans have been divided to advocated and opponent groups:
The opponent group are assuring that the MST (MetaTrader Srategy Tester) is not trustworthy and even a useless.
The second group deny these indictments and saying may be that was true for the previous versions of MetaTrader but the strategy tester of the current version is more accurate and trustworthy.
I’m personally partial to a third group saying that there’s nothing is 100% accurate but there’s a possibility of better accuracy if we set all the required conditions.
We will know how to get the maximum of MST accuracy.
Exploring the MetaTrader Strategy Tester:
We are going to study the MST with the MACD Sample expert advisor which shipped with MetaTrader. We are not concerned about is it a good strategy or bad but we have chosen it because you and me have it in our machines.
To run the MST go to View menu and choose Strategy Tester, that will bring the MST window (Figure 1). (You can click CTRL+R or F6 hot keys to bring the MST).
Figure 1 - MetaTrader Strategy Tester
In the first window (figure 1) you have got when you opened the MST you find the simple yet most important options:
Expert advisor:
Here you choose the expert advisor you want to test, in our
lesson we have chosen
MACD Sample.
Note: The expert advisor must be compiled and placed
in the /EXPERTS folder to find it in the Expert advisor list.
Symbol:
Choose the currency symbol you want to test your strategy on.
Note: Trading is permitted for the symbol under test
only, no portfolio testing. Attempts to trade using another symbol will
return error.
Period:
Choose the timeframe you want to test your strategy in.
Note: Weekly, monthly, and irregular timeframes are
not allowed in MST. For more details about MST limits navigate to: tester_limits
Model:
Determine the method that MST will use for price bars modeling which you want to test your strategy.
There are three modeling methods you can choose from:
Every tick (on the basis of all available least timeframes with
fractal interpolation of every tick)
In this method the bars
generated on the basis of all the smallest available timeframe data not
only the data of the nearest timeframe (Control points method) nor the
last open price.
If there are duplicated data for the same time span
the MST will filter these data based on the volume of them.
Control points (the nearest timeframe with fractal
interpolation are used)
In this method MST uses the last 12
bars of the current timeframe and the method of fractal generation. At
that, the price development within one bar will resemble the dynamics of
the last ten bars. If there are data of a less timeframe, 5 bars of a less
timeframes are used for fractal generation.
Open prices only (the fastest method on the bars completed)
In this method the open prices of the current timeframe are
used.
Note: The current price bar is fully completed can
only be known when the next one appears.
Recalculate:
MST can use the data already cashed (from a pervious testing) in the
.fxt files.
If you enable this option the tester will delete the
existing cashed data and create new one based on available data and chosen
modeling method.
Optimization:
When you enable this option you can use the MST optimization features, we will discuss these features later in this article.
Expert properties:
Clicking this button will open the Expert properties window: Where you
can set the testing deposit and testing positions (short and long) (Figure
2).
And where you can use it to change the properties of the expert
advisor you are testing (Figure 3).
And set the optimization settings
(Figure 4).
Figure 2 - Expert advisor properties
Figure 4 - Optimization settings
Symbol properties:
Clicking this button will open the currency symbol properties window (Figure 5).
Note: This information is written down in the header
of an *.fxt file and used for server emulation.
Figure 5 - Symbol properties
Open chart:
Clicking this button will create and open a new chart based on the symbol you used in testing and the indicators you used in your expert advisor.The arrows of opening and closing and other objects used in your expert advisor will be drawn on the chart as well (Figure 6).
Note: This chart window can be opened only
after the testing is over.
Figure 6 - MST chart window
Modify Expert:
Click this button if you want to see or edit the source code of the expert advisor. The expert advisor will be opened in MetaEditor.
Start:
Clicking this button will strart the testing.
We have too much to say about the MetaTrader Strategy Tester (MST) in the next series of articles.
I hope you enjoyed the article
I welcome very
much your questions and suggestions.
Coders’ Guru
» printer-friendly version | login or
register to post
comments