Tick story - page 10

 
Vasiliy Sokolov:
Time is a real problem in MT5. First, the system datetime type is too low resolution, by modern standards one second is an eternity. Secondly, arrival of events is not related to time. Suppose we get a new screenshot of a glass in OnBookEvent, and what time does it refer to? Should we fetch TimeCurrent with the last known time of the server? What if the last known server time was updated a minute ago?

They are unlikely to change the datetime before the year 3000

последняя дата datetime 3001.01.01 00:00:00 | 32535216000

It's a lot easier to make a wrapper.

struct millisekdatetime
  {
   datetime time;
   ushort millisek;
  };
 
Tapochun:
I don't need an indicator. And I don't need mode differences. Tell me, do you observe differences of the same ticks when requesting from one mode a different amount (e.g., 2000 and 10000).
Karputov Vladimir:
Now I understand it. I need to check it...

Ghjdt Checked. So: in one and the same tool for one and the same mode of tick receipt (I looked for the mode COPY_TICKS_INFO - only Bid and Ask) and at different depth of tick request we receive different tick stream. The attached file of the Expert Advisor (v. 1.41) clearly shows the reason of such behaviour:

1

When requesting 1500 it returns 1500 ticks, when requesting 10000 it returns 4691. Generally, if it returns more than 2000 ticks, then the mode of giving back the history changes.

Files:
CopyTicks.mq5  4 kb
 
Karputov Vladimir:

Ghjdt Checked. So: in one and the same code for one and the same tick receiving mode (I checked COPY_TICKS_INFO mode - only Bid and Ask) and at different depth of tick request a tick stream is received differently. The attached file of the Expert Advisor (v. 1.41) clearly shows the reason of such behaviour:

When requesting 1500 it returns 1500 ticks, when requesting 10000 it returns 4691. In general, if more than 2000 ticks are returned, then the history return mode is changed.

There, great, I have the same. I wrote to servicedesk, we'll wait.
 
Tapochun:
That's great, I have the same thing. I wrote to servicedesk, we will wait.

I have noticed an interesting feature. I ran the EA described in my previous post with a new instrument (it hasn't requested tick history yet and therefore hasn't created files with tick history on the disk) and found out that at first it returned about 200 ticks when requesting 2000. But gradually, with each tick, the number of ticks returned grows - it feels like online history is being added to the initial 200 ticks as I write here.

Added: attached EA v 1.42 - fixed the range exit bug on the very first run.

Files:
CopyTicks.mq5  4 kb
 
Upgraded to the new build 1190. Recompiled EA in new version. In tester CopyTicks() does not get ticks - error 4014.
 
Karputov Vladimir:

I have noticed an interesting feature. I ran the EA described in my previous post with a new instrument (it hasn't requested tick history yet and therefore hasn't created files with tick history on the disk) and found out that at first it returned about 200 ticks when requesting 2000. But gradually, with each tick, the number of ticks returned grows - it feels like online history is being added to the initial 200 ticks as I write here.

Added: attached EA v 1.42 - fixed the range exit bug on the very first run.

Yes, Renat noted that the ticks are being loaded. So we should check for a -1 return (at least). In contrast, the COPY_TICKS_INFO mode allows the analyzer to check the equality of the returned ticks to the requested one, even if it is not so important. It will still return less.
 
Tapochun:
Yes, Renat pointed out that the ticks are being picked up. So, it's necessary to check for -1 (at least). And in COPY_TICKS_INFO mode, you may check returned amount equal to requested one, even if you don't - it's useless.
Well, I won't be able to check anything with ticks until Monday. I will deal with other things.
 

Tried requesting ticks now - on the offline chart. Regardless of the mode and the number of ticks requested, the result is about the same: no bid prices at all (all ticks have bid = 0).

 
Karputov Vladimir:
Well, you won't be able to believe anything with tics until Monday anyway. I'll do something else.
Why? If you download an indicator, there is a great button to refresh. And nobody cancelled the scripts.
 
Please explain again. What is the depth of tick history available now? Is the history downloaded from the server, i.e. it does not need to be accumulated? How does the tester work, does it use tick simulation or tick history?