Popular Posts

Editor'S Choice - 2020

MQL4: Testing on a Real History

Greetings, gentlemen, MQL programmers!

With this post we are completing a series of lessons on working with quotes.

Previous lessons:

  1. Tick ​​data collector in the form of an indicator;
  2. Converter of tick files to csv format;
  3. Gluer of several files with tick data into one file;
  4. Checking the accumulated tick history for holes.

Today we will write a script that saves tks quote files to the hst format used by the strategy tester.
Thus, we can test the advisors on the ticks that we collected from the selected broker using the indicator written earlier.

When testing the performance of experts in the MetaTrader 4 strategy tester, the most meticulous traders encounter limited accuracy in the testing process. This limitation is connected with the fact that the detailed history of quotes is stored by the terminal in the form of minute candles. In turn, each minute candlestick is represented by only four values ​​(prices of opening, closing, maximum and minimum). In many cases, this is enough to reproduce real events, which the tester does by modeling the behavior of the price inside the minute candle. But for those cases when it comes to recovering events during the release of important news, modeling is powerless, and only a detailed tick history can help restore real events.


Nevertheless, even with the collected tick history, the trader is faced with the problem of its substitution in the strategy tester. Unfortunately, there is no regular way to import your own quotes into the strategy tester. But this can be done using special utilities that convert the collected data about the tick history into the tester's file format - fxt.

As you remember, in the last lessons we learned how to collect tick history and save it in special files with the tks extension. We also learned to check tks files for holes and stitch files together into one final file. Today we will write a special script that will allow us to create files used by the strategy tester for testing and optimization of advisers. Thus, we will have practically all the tools for creating and using our own database of historical data, and the cycle of lessons on working with quotes can be completed.

Watch the video: Metatrader 4 - 99% Back-testing in 5 Simple Steps (February 2020).

Leave Your Comment