Many 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 was made quickly, but not precisely enough.
It is important to choose a relevant way of modeling development of 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 Bars
There are three ways of modeling development of bars used in MetaTrader 4 Client Terminal:
- Every tick (based on all available least timeframes with fractal interpolation of every tick)
- Control points (the nearest timeframe with fractal interpolation are used)
- Open prices (quick method on completed bars)
Intermediate price bars are generated before testing starts, the results being saved
in file (for example: /tester/history/eurusd_1440_1.fxt). Data cached in this way allow
accelerate the tester hugely afterwards. After "Recalculate" has been enabled, recalculation of intermediate data can be managed.
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 Modeling
Let us begin with the simplest modeling method based on hourly chart.
Now, let us study the hour bar (June, 30 2005, 12:00) highlighted with red:
Open Price
Some traders do not wish to depend on particluarities of intrabar modeling and create experts
trading on the bars completed. The fact that the current price bar is fully completed can only be
known when the next one appears. These are the experts 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
expert to identify the end of completion of the preceding price bar. It is this incipient bar
on which expert testing is launched. At the next stage, the current bar, fulle 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 experts trading within a bar.
To use this method, history data of the nearest less timeframe must be available. In the most cases,
the data of a smaller timeframe available do not completely cover the time span of the timeframe under test. If there are no
data of a smaller timeframe, the bar development is generated on basis of close prices of the preceding 12 bars. I.e., the movement
within a bar repeats the price movement for the last 12 timeframes, this is that is called fractal interpolation.
This generation method is totally different from the flooding method used in the preceding vewrsions of Client Terminal,
since that method allowed a strictly determined bar development. As soon as history data of a smaller
timeframe appear, fractal interpolation will apply to these new data. However, not 12, but only 6 preceding
bars are used. I.e., real prices of Open, High, Low, Close plus 2 more generated prices are reproduced.
The value and location of these two generated prices depends on the price movement on the 6 preceding timeframes.
Every Tick (based on all available least timeframes with fractal interpolation of every tick)
This mode allows to model price movement within a bar the most precisely. 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 simlutaneously,
the data of the smalles timeframe are used for generation. Like the preceding method,
this method uses fractal generation of control points. Fractal interpolation is used again
to generate price movement between control points. It may happen that several identical ticks are generated one after another.
In this case, duplicated quotes are filtered, and the volume of the last 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 all 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 Modeling
The range of dates can be set up in the Settings tab: check the "Use date" box and specify dates in "From:" and "To:" fields.
The range of dates can be used not only for testing an expert advisor, but also for generating the test 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 test sequence (or always, if the "Recalculate" box is checked)
there was a possibility to use the range of dates, then bars, exceeding the given range were not generated, but just overwritten
in the output sequence. The data are not excluded from the sequence in order the possibility to remain that allows to calculate
indicators correctly for the whole history received. It must be noted that the first 100 bars are not generated either,
this limitation does not depend on the range of dates being set up.
Referencing M1 Timeframe
To check the accuracy of intrabar modeling, the minutes chart of June, 30 2005, between 12:00 a.m. and 1:00 p.m. will be used.
A simple scaling of the original minutes chart (green line is the Close price) and its superimpositioning on the chart of all-tick
modeled data results in a practically exact coincidence:
Conclusions
Maximally precise testing can be performed and simulation veracity can be well assured if
there are auxiliary smaller timeframes 100% covering the timeframe under test.
I.e., the problem of a qualitative every-tick testing turns into the search for detailed history data...