MQL4: Analysis of Accumulated Tick History

image thumbGood afternoon, my inquisitive beginner programmer friends (and not so beginner ones)!

As you remember from the previous lessons, we are creating a toolkit for full-fledged work with tick quotes. We already have the following tools:

  • A collector of tick data in the form of an indicator;
  • A converter of tick files into csv format;
  • A splicer of several files with tick data into one file.

And in today's video lesson I have prepared one more powerful tool for working with ticks, which will help check their quality and the absence of gaps.

The thing is that when recording data with the help of our indicator, a number of various force majeure circumstances may arise, which will result in errors during expert advisor testing. And, as a result, in the loss of real money due to unsatisfactory testing quality. If the connection is interrupted, the server freezes, reboots, or any other circumstances occur, critically large gaps between quotes may appear in the files we create. It is important at the very least to detect them in time and be aware of the critical places, and ideally to patch the gaps from other sources. For example, you can run the indicator for collecting ticks on two different VPS from different providers for reliability.

In any case, to identify such critical gaps, today we will write a special script.

It will catch the absence of ticks for a certain period of time, and if the period with no new ticks exceeds the value specified in the settings, it will write about this to a special file in the form of a table. The script treats the absence of ticks during holidays (Christmas, New Year) as gaps. This is done for the reason that the suspension of trading by different brokers on such dates occurs at different times. Therefore, it is quite difficult to universally determine where there is a real gap and where there is an actual trading halt and its subsequent resumption.

The situation is different with weekends, since for most brokers weekends fall on the same days of the week (Saturday and Sunday) and at approximately the same time. For this reason, there will be no standard weekends in the list of gaps.

Well then, now let's get down to writing it.

Download the Tick Data Analysis script

The following lessons from the "Working with Quotes" cycle:

  • MQL4: Testing on real history

Respectfully yours, Dmitriy aka Silentspec
TradeLikeaPro.ru

Good afternoon, my inquisitive beginner programmer friends (and not so beginner ones)!