Download MetaTrader 5

MqlTick, Time - No fractals of seconds?

To add comments, please log in or register
Carl Schreiber
7301
Carl Schreiber  

Hi,

Is it correct that live the time of MqlTick does not show fractals - the last one from Friday doesn't show any?

Fractals would mean that each new tick would have a different timestamp (fractal) than the previous one, while otherwise several ticks within the same second would have the same timestamp!

(The doc tells only: ...// Time of the last prices update

Thanks in advance.

Fernando Carreiro
2911
Fernando Carreiro  
Carl Schreiber: Is it correct that live the time of MqlTick does not show fractals - the last one from Friday doesn't show any?

Fractals would mean that each new tick would have a different timestamp (fractal) than the previous one, while otherwise several ticks within the same second would have the same timestamp!

Yes, even though the MqlTick structure does have a "millisecond" variable (namely "time_msc"), it is in fact just a rendition of the "seconds" based time-stamp converted into milliseconds.

Also, I think that you probably meant to say "fractional" and not "fractal" which is something else entirely.

However, if you really needed to measure fractional seconds, you could use "GetTickCount()" to measure the delay between calls to OnTick() and so compensate, but this would only be an approximate emulation as it will suffer from execution delays as well as the 15ms resolution the OS presents.

Carl Schreiber
7301
Carl Schreiber  
Fernando Carreiro:

Yes, even though the MqlTick structure does have a "millisecond" variable (namely "time_msc"), it is in fact just a rendition of the "seconds" based time-stamp converted into milliseconds.

Also, I think that you probably meant to say "fractional" and not "fractal" which is something else entirely.

However, if you really needed to measure fractional seconds, you could use "GetTickCount()" to measure the delay between calls to OnTick() and so compensate, but this would only be an approximate emulation as it will suffer from execution delays as well as the 15ms resolution the OS presents.

Thanks - I just want to be sure that this cannot be used to detect new ticks.
Fernando Carreiro
2911
Fernando Carreiro  
Carl Schreiber: Thanks - I just want to be sure that this cannot be used to detect new ticks.
When there is a new tick, the function "SymbolInfoTick" returns true. If no new tick is available, it returns false.
Carl Schreiber
7301
Carl Schreiber  
Fernando Carreiro:
When there is a new tick, the function "SymbolInfoTick" returns true. If no new tick is available, it returns false.

The doc says: "The function returns current prices of a specified symbol in a variable of the MqlTick type.
                      Return Value
                      The function returns true if successful, otherwise returns false"

So true or false can mean as well no tick available (due to techn. reasons - check error code?) and if true and no new tick the same old tick is again stored in the struct var.

Fernando Carreiro
2911
Fernando Carreiro  
Carl Schreiber:

The doc says: "The function returns current prices of a specified symbol in a variable of the MqlTick type.
                      Return Value
                      The function returns true if successful, otherwise returns false"

So true or false can mean as well no tick available (due to techn. reasons - check error code?) and if true and no new tick the same old tick is again stored in the struct var.

Tech. difficulties on not, "false" is still "no new tick available"!

EDIT: All you are really needing is when it is "true", then there is a new tick available to you!

EDIT2: You may be correct! I may be misreading the docs!

EDIT3: Upon further reading it states in the docs:

The parameters of each tick are filled in regardless of whether there are changes compared to the previous tick.
To add comments, please log in or register