Is there difference to use market prices or ask/bid?

 

Is there any difference between to use "Ask" directly  and to use "MarketInfo (Symbol(), MODE_ASK)" instead?

In another word,  "MarketInfo (Symbol(), MODE_ASK) " = "Ask"? "MarketInfo (Symbol(), MODE_BID) " = "Bid"?

Otherwise, when are they same? When are they different? Thanks. 

 

When you call MarketInfo, you will get the latest up to date Ask etc. Pretty much the same as using RefreshRates and then Ask etc.

If the EA runs for a while and ticks are missed, Ask will be the same as it was at the program start, so can be updated with RefreshRates or MarketInfo. 

 

MarketInfo has the advantage of getting you the Ask of a different pair if you need it.

But they return the same information.

   printf("Ask = %.5f",Ask);
   printf("MarketInfo = %.5f",MarketInfo(NULL,MODE_ASK));
   printf("SymbolInfoDouble = %.5f",SymbolInfoDouble(NULL,SYMBOL_ASK));

 

 
honest_knave:

MarketInfo has the advantage of getting you the Ask of a different pair if you need it.

But they return the same information.

 

 

Well, as Gumrai mentioned, while the Ask, Bid are constants during event methods (until RefreshRates), the MarketInfo always returns the last known price. It is not so obvious from the Docs.
 

I intended my information to supplement GumRai rather than correct it... I should have chosen a different phrase to "they return the same information" (as in you can use them to retrieve the same info). My bad, and apologies for any confusion caused!

 
GumRai:

When you call MarketInfo, you will get the latest up to date Ask etc. Pretty much the same as using RefreshRates and then Ask etc.

If the EA runs for a while and ticks are missed, Ask will be the same as it was at the program start, so can be updated with RefreshRates or MarketInfo. 

Do you know whether CopyRates() automatically returns updated prices - like MarketInfo(..) - or does it need a RefreshRates() as well like Ask and Bid?
 

CopyRates() does need a RefreshRates()

 
honest_knave:

CopyRates() does need a RefreshRates()

Ah, ok - thanks!
 

Thank you all ! 

Reason: