Missing ticks when trying to collect/save ticks.

 

Dear all,

I'm facing the following problem, I need to save some ticks data to develop my strategy, ticks that are coming from my broker through MT4.

I tried different way of saving it, it works fine, but whatever way I use to save those ticks (saving them to an array and then writing them to a .CSV file or writing them everytime a new tick come, using the RefreshRates function or not etc...) I am comparing the ticks that are saved to the market watch window and I can clearly see that some ticks are missing.

Then I created an indicator that plots the Bid and Ask ticks directly to a MT4 chart, and it is obvious that I still have some ticks missing.

The ticks that misses are precisely the Bid and Ask rates that are not staying more than half a second (I would even say 1/10 of a second) on the Market Watck chart.

Do you know if there is another way than MarketInfo("Symbol",MODE_BID) or RefreshRates(); and Bid; to get ALL the ticks that are coming?

Or is it the Market Watch Window that displays more ticks than they are really (I don't believe it)

Thank you very much in advance for your help!

Aerial.

 

aerial:

[...] Or is it the Market Watch Window that displays more ticks than they are really [...]

Probably not... Can you post the code u are using? Maybe start() function takes too long to execute so you are missing any incoming ticks during it's run. If you are doing it in a loop, maybe you are sleeping to long or maybe each iteration is taking too long to execute... Regardless, I doubt there is a solution that will guarantee capturing 100% of ticks.

An alternative explanation is that you might be wrong, and you are seeing things that are not there...

 
aerial:

Dear all,

I'm facing the following problem, I need to save some ticks data to develop my strategy, ticks that are coming from my broker through MT4.

I tried different way of saving it, it works fine, but whatever way I use to save those ticks (saving them to an array and then writing them to a .CSV file or writing them everytime a new tick come, using the RefreshRates function or not etc...) I am comparing the ticks that are saved to the market watch window and I can clearly see that some ticks are missing.

Then I created an indicator that plots the Bid and Ask ticks directly to a MT4 chart, and it is obvious that I still have some ticks missing.

The ticks that misses are precisely the Bid and Ask rates that are not staying more than half a second (I would even say 1/10 of a second) on the Market Watck chart.

Do you know if there is another way than MarketInfo("Symbol",MODE_BID) or RefreshRates(); and Bid; to get ALL the ticks that are coming?

Or is it the Market Watch Window that displays more ticks than they are really (I don't believe it)

Thank you very much in advance for your help!

Aerial.

Try this one....

Files:
 
Jake2701:
Attached:
Tick_recorder_v2.mq4 (3.58 KB)
Or this one -> https://www.mql5.com/en/code/7777.
 

A Sample: Tick counter -> https://www.mql5.com/en/code/8585

 

Many thanks to all of you!

I should have looked for an already written program like those you showed. Apparently I still need to improve my programming skills ;)

It works perfectly now!

Aerial

Reason: