Download MetaTrader 5

Should Bid always be preceded by RefreshRates() ?

To add comments, please log in or register
SteveD
15
SteveD  

Hi,

This simple routine gives me an output of the latest tick every 5 seconds.  But I've found that if I don't use RefreshRates() before Bid, the routine just repeats the first value received.  Is this the right way to ensure that I get a new value every time Bid is accessed?


for (n = 1; n <= 10; n++)

    {
      RefreshRates();
      Alert(Bid);
      Sleep(5000);     
    }  

    

Thanks,

Steve.

qjol
3243
qjol  

what about

MarketInfo(Symbol(), MODE_BID)

?

SteveD
15
SteveD  
Yep, that works thanks.  Is that better than doing RefreshRates() then?
Ian Venner
2584
Ian Venner  

It amounts to the same thing

SteveD
15
SteveD  
Ok thanks.
whroeder1
15553
whroeder1  
SteveDavies:  Is this the right way to ensure that I get a new value every time Bid is accessed?
You must RefreshRates before using any predefined variables after sleep and all server calls (OrderSend, modify, delete.)
SteveD
15
SteveD  
Thanks for that WHRoeder.  That answers it.
Jon Grah
367
Jon Grah  
WHRoeder:
SteveDavies:  Is this the right way to ensure that I get a new value every time Bid is accessed?
You must RefreshRates before using any predefined variables after sleep and all server calls (OrderSend, modify, delete.)

So refreshRates is still applicable even with mt4 build 600+
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
Now you got me curious. What makes you think it is not?
To add comments, please log in or register