Download MetaTrader 5

new mql4 providing millisecond in timestamps....

To add comments, please log in or register
Jon Grah
365
Jon Grah  

Currently, mql4 can only provide time down to the nearest second for incoming ticks. We use the following function:

MarketInfo(Symbol(), MODE_TIME)

1) Is there a different function that can provide millisecond time stamp or can be used to determine milliseconds for tick data coming to the platform?

2) will the new mql4 that is combining mql5 functions be able to request or obtain millisecond (or sub-second) time stamps on incoming ticks?

So how is the mt4 (and mt5) platform supposed to properly distinguish between ticks that come in at the 'same time'?

Ubzen
5390
Ubzen  
4evermaat:

Currently, mql4 can only provide time down to the nearest second for incoming ticks. We use the following function:

MarketInfo(Symbol(), MODE_TIME)

1) Is there a different function that can provide millisecond time stamp or can be used to determine milliseconds for tick data coming to the platform?

2) will the new mql4 that is combining mql5 functions be able to request or obtain millisecond (or sub-second) time stamps on incoming ticks?

So how is the mt4 (and mt5) platform supposed to properly distinguish between ticks that come in at the 'same time'?

1) GetTickCount(), should work Live. Pointless on historical data.

2) Even mt5_data isn't saved in milliseconds. However, no_problem Live.

3) I don't see where you're going with that. If it's the same time in milliseconds then having milliseconds wouldn't help. If it's different times in milliseconds than GetTickCount() might help. Help in the sense that your code processes the current tick within less than a millisecond. How important all depends upon what you're trying to accomplish... i guess.

Ex Ovo Omnia
3315
Ex Ovo Omnia  

You have at least two choices.

1. Distinguish the ticks with the MQL's GetTickCount(), which has 16 ms precision.

2. Access PC time using GetLocalTime() from Kernell32.dll with nanosecond precision (this does not work with emulators on linux, they still return the 16 ms precision).

Ian Flanagan
549
Ian Flanagan  

4evermaat: I think ticks are distinguished by Volume. Every time a new tick is sent by the broker, the Volume will increase by one. E.g. if you are looking at an M1 chart, the volume for a particular bar is how many ticks were sent in that minute.

Actually yesterday I tried to make a function that records the time with milliseconds. It used TimeCurrent() and GetTickCount(). Mathematically, it was right.. but GetTickCount() is not accurate enough. I found that rounding event times to the last second (i.e. just using TimeCurrent() ) had smaller errors than my function... :/

I'll try again another day but as far as I can see, you cannot rely on GetTickCount() if you need accuracy within a second.

Maybe C++ experts can access more accurate equivalents of GetTickCount()..?

Ian Flanagan
549
Ian Flanagan  
Ovo:

You have at least two choices.

1. Distinguish the ticks with the MQL's GetTickCount(), which has 16 ms precision.

2. Access PC time using GetLocalTime() from Kernell32.dll with nanosecond precision (this does not work with emulators on linux, they still return the 16 ms precision).


1) From my tests, I don't believe GetTickCount() has 16ms precision. It's true, 16ms is the small value I get (apart from 0), but I don't think values about 16ms are precise to the closest 16ms. :/

2) Ah that's a great idea. I'll give that a try.

Ex Ovo Omnia
3315
Ex Ovo Omnia  
alladir:


1) From my tests, I don't believe GetTickCount() has 16ms precision. It's true, 16ms is the small value I get (apart from 0), but I don't think values about 16ms are precise to the closest 16ms. :/

2) Ah that's a great idea. I'll give that a try.


Sorry, I often mess accuracy with precision, I am not sure even now which is which.
Ian Flanagan
549
Ian Flanagan  
Ovo:

Sorry, I often mess accuracy with precision, I am not sure even now which is which.

Me neither, all I know is I have a formula that should work mathematically but in real life doesn't... so I'm blaming GetTickCount() :)
szgy74
265
szgy74  
alladir:

4evermaat: I think ticks are distinguished by Volume. Every time a new tick is sent by the broker, the Volume will increase by one. E.g. if you are looking at an M1 chart, the volume for a particular bar is how many ticks were sent in that minute.


I have seen this many times before but are you sure about this? I checked this some times on my ECN broker and the volume increases quite differently on every tick, it is probably the actual traded lots flowing though that broker. For example when I sell 10 lots, next tick lots will be +10, not +1.

Ian Flanagan
549
Ian Flanagan  

Volume goes up by 10 when you trade 10 lots?!? I haven't experienced that. I run a tick collector that records every tick. Sometimes volume goes up by 2 or 3 but I guessed it was very fast ticks that either the broker didn't send, or arrived while the Start function of my tick collector was still running.

Yeh, I only think Volume = Ticks from googling, but it seems to fit with the data I'm seeing

Simon Gniadkowski
Moderator
18021
Simon Gniadkowski  
szgy74:

I have seen this many times before but are you sure about this? I checked this some times on my ECN broker and the volume increases quite differently on every tick, it is probably the actual traded lots flowing though that broker. For example when I sell 10 lots, next tick lots will be +10, not +1.

Volume is a bad name for what is actually "Tick count" . . . it's nothing to do with traded volume/lots . . . the reason it can change by more than 1 is because you can miss ticks.
Alain Verleyen
Moderator
32853
Alain Verleyen  
4evermaat:

Currently, mql4 can only provide time down to the nearest second for incoming ticks. We use the following function:

MarketInfo(Symbol(), MODE_TIME)

1) Is there a different function that can provide millisecond time stamp or can be used to determine milliseconds for tick data coming to the platform?

2) will the new mql4 that is combining mql5 functions be able to request or obtain millisecond (or sub-second) time stamps on incoming ticks?

So how is the mt4 (and mt5) platform supposed to properly distinguish between ticks that come in at the 'same time'?

There is no such information in mql5 neither. But there is Timer events which can be used with milliseconds precision, though I don't know if this feature will be available with the new mql4.
1234
To add comments, please log in or register