Download MetaTrader 5
To add comments, please log in or register
Do you know C++? MQL5 has much in common with it. Just try it yourself!
SteveD
15
SteveD 2014.06.18 11:07 

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 2014.06.18 11:43  

what about

MarketInfo(Symbol(), MODE_BID)

?

SteveD
15
SteveD 2014.06.18 13:02  
Yep, that works thanks.  Is that better than doing RefreshRates() then?
Ian Venner
2583
Ian Venner 2014.06.18 14:37  

It amounts to the same thing

SteveD
15
SteveD 2014.06.18 15:39  
Ok thanks.
whroeder1
13610
whroeder1 2014.06.18 15:53  
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 2014.06.19 08:23  
Thanks for that WHRoeder.  That answers it.
Jon Grah
367
Jon Grah 2014.06.20 05:23  
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 2014.06.20 06:57  
Now you got me curious. What makes you think it is not?
/
To add comments, please log in or register