Am I correct and fail safe this way?

Back to topics list To post a new topic, please log in or register
avatar
2017
gooly 2015.09.11 14:55
 

Hi,

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

Note

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:

SymbolInfoTick(sym,tick);
SymbolInfoDouble(sym,SYMBOL_TRADE_TICK_VALUE);

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

Gooly

avatar
125
zirkoner 2015.09.11 18:16 #
 

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

avatar
2017
gooly 2015.09.11 20: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..?

Back to topics list  

To add comments, please log in or register