| / | Articles |
Articles
Tester
Strategy Tester: Modes of Modeling during Testing
To post a new article, please log in or register
|
Strategy Tester: Modes of Modeling during Testing [ ru | cn ]IntroductionMany programs of technical analysis allow to test trading strategies on history data. In the most cases, the testing is conducted on already completed data without any attempts to model the trends within a price bar. It can be made quickly, but not precisely enough. It is important to choose a relevant way of modeling price bars to make a quality testing of a trading strategy. Indeed, there cannot exist an ideal situation when there is a full tick history for an extremely accurate testing. It is very difficult for a normal trader to find the full tick history for a period of several years, in order to analize it. To solve this problem, the data of more precise periods can be used as reference points with modeling price changes between them. Ways of Modeling Price BarsThere are three ways of modeling development of bars used in MetaTrader 4 Client Terminal:
Intermediate price bars are generated before testing starts, the results being saved in file (for example: /tester/history/eurusd_1440_1.fxt). Every time the Start button is clicked, Tester will newly generate the file containing the testing sequence of ticks. Fxt-files are easy to open in the terminal as offline charts via File -> Open offline. The use of data cached before allows to perform tests on the basis of the own intermediate data. To do so, it is sufficient to save file in a proper format (*.FXT format, completely open)into /tester/history/ directory. These files are easy to open in terminal as offline charts through File -> Open offline. ![]() Examples of ModelingLet us begin with the simplest modeling method based on a one-hour chart. Now, let us study the one-hour bar (September, 5 2007, 10:00) highlighted with red: ![]() Open PriceSome 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 (the nearest less timeframe)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 (available least timeframes)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. ![]() A possible large amount of tick data generated must be considered. This may influence consumption of operating system and speed of testing. Attention: There is no need to launch the every-tick testing if there are no smaller timeframes
fully covering the timeframe under test. This modeling is intended only for testing
on the basis of data of smaller timeframes! Using the Range of Dates when ModelingThe range of dates can be used for both Expert Advisor's testing and for generation of testing sequence of bars. There is often no need to generate data of the whole history, especially for Every Tick modeling, where the amount of unused data can be very large. So, if at the initial generation of testing sequence there was a possibility to use the range of dates, then bars exceeding the given range are not generated, but just overwritten in the output sequence. The data are not excluded from the sequence in order to be able to calculate indicators correctly for the whole history obtained. It must be noted that the first 100 bars are not generated either, this limitation does not depend on the set up range of dates. Referencing M1 TimeframeTo check the accuracy of intrabar modeling, the minutes chart of September, 5 2007, between 10:00 and 11:00 p.m. will be used. ![]() In the every-tick mode, the following sequence was generated:
Since the mean tick volume of each bar within this range does not exceed 5, the
sequence was generated with the minimal use of interpolation. Practically all prices
are really existing OHLC prices.
Even without scaling, just by simple superimposing of a one-minute chart onto a
one-hour chart (close prices are shown as a green line on the one-hour chart generated),
they appear as practically identical:
![]() ConclusionsMaximally precise testing can be performed and simulation veracity can be well assured if there are auxiliary smaller timeframes available that 100-% cover the timeframe under test. I.e., the problem of a qualitative every-tick testing turns into the search for detailed historical data... Warning:
All rights to these materials are reserved by MetaQuotes Software Corp.
Copying or reprinting of these materials in whole or in part is prohibited.
dear all, I tested my EA and my modeling quality is 90% (start from 1st february 2008 till 14th july 2008). with use trade: "everytick...." but when I extended the period of testing (older than january 2008), the modeling quality shown "N/A". Could anyone explain to me how the MetaTrader calculate the Modeling Quality so the result of modeling quality could change dramatically like the data I shown above?? Many thanks for your help. Rgds, Michael
2008.07.15 07:01 mike1247
Paldamo wrote: Sorry, for delay. Anyway you should investigate your EA logic.Why does the OPEN PRICE ONLY setting, generates orders at time =0 and at time =21:00?
2006.12.29 13:28 MetaQuotes
jmiranda wrote: Yes.Once there's no smaller time frames then 1 minute, does the Every Tick method generates prices within an 1 minute bar at a 1 min time frame?
2006.12.29 13:27 MetaQuotes
Once there's no smaller time frames then 1 minute, does the Every Tick method generates prices within an 1 minute bar at a 1 min time frame?
2006.12.13 22:01 jmiranda
Why does the OPEN PRICE ONLY setting, generates orders at time =0 and at time =21:00?
2006.02.02 04:59 Paldamo
5 comments
|