Download MetaTrader 5

Am I correct and fail safe this way?

To add comments, please log in or register
We have launched Spanish and Portuguese versions of the website. Try them!
Carl Schreiber
Carl Schreiber 2015.09.11 12:55 


In the MQL4-Reference I just read in the capital of SymbolInfoDouble():


It is recommended to use SymbolInfoTick() if the function is used for getting information about the last tick.
It may well be that not a single quote has appeared yet since the terminal is connected to a trading account.
In such a case, the requested value will be indefinite.

In most cases, it is enough to use SymbolInfoTick() function allowing a user to receive the values of
Ask, Bid, Last, Volume and the time of the last tick's arrival during a single call.

The following example does NOT realize this hint.

So to be save do I have to use SymbolInfoTick() before using SymbolInfoDouble(), like:


I definitely won't like the idea of getting indefinite once and a while and accidentally!


Zirkon 2015.09.11 16:16  

No, you have to check the return value of the function to see it you got the information or not.

Carl Schreiber
Carl Schreiber 2015.09.11 18:05  

How shall I check? It says indefinite not infinite. So I have nothing to check against it and the ticks-value varies and can be pretty high.

Beside that I assume that I might the values for another symbol? in this case it would even help to use the version of the function that returns a boolean value - it could be true but..?

To add comments, please log in or register