current rates

 

Do I need to:

RefreshRates();

before I do:

MarketInfo(symbol, MODE_ASK);

My understanding is that RefreshRates() will update Bid and Ask constants, but if you are read them through MarketInfo(), you will receive the newest one and you don't need to use RefreshRates();

So in a nutshell RefreshRates() works like this:

void RefreshRates() {
  Ask = MarketInfo(symbol, MODE_ASK);
  Bid = MarketInfo(symbol, MODE_BID);
}
Am I right?
 
bool RefreshRates( )

Refreshing of data in pre-defined variables and series arrays.

So I think you are correct . . .

 

OK, I tested it with the script:

Print(Ask, "=", MarketInfo(Symbol(), MODE_ASK), " ; ", Bid, "=", MarketInfo(Symbol(), MODE_BID));
Sleep(2000);
Print("2 sec delay, before refresh");
Print(Ask, "=", MarketInfo(Symbol(), MODE_ASK), " ; ", Bid, "=", MarketInfo(Symbol(), MODE_BID));
Print("2 sec delay, after refresh");
RefreshRates();
Print(Ask, "=", MarketInfo(Symbol(), MODE_ASK), " ; ", Bid, "=", MarketInfo(Symbol(), MODE_BID));

So I am right :)

 

So in a nutshell RefreshRates() works like this:

void RefreshRates() {
  Ask = MarketInfo(symbol, MODE_ASK);
  Bid = MarketInfo(symbol, MODE_BID);
}
Am I right?
More like
double mi[]; // Thread local copy (one per EA/script)
void RefreshRates() {
  ArrayCopy(mi, globalMI); // Current values from last server message.
  Ask = MarketInfo(symbol, MODE_ASK);
  Bid = MarketInfo(symbol, MODE_BID);
}
MarketInfo(s,m){
...
  case MODE_BID: return(mi[20]);
  case MODE_ASK: return(mi[21]);
}
It updates ALL values. Bid/Ask, account equity, etc.
Reason: