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

Back to topics list To post a new topic, please log in or register
avatar
228
jollydragon 2015.11.13 03:08
 

 

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. 

avatar
Moderator
3404
GumRai 2015.11.13 03:35 #
 

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. 

avatar
735
honest_knave 2015.11.13 08:30 #
 

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));

 

 

avatar
1109
Ovo 2015.11.13 14:27 #
 
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.
avatar
735
honest_knave 2015.11.13 14:47 #
 

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!

 

avatar
2017
gooly 2015.11.13 16:23 #
 
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?
avatar
735
honest_knave 2015.11.13 16:36 #
 

CopyRates() does need a RefreshRates()

 

avatar
2017
gooly 2015.11.13 18:08 #
 
honest_knave:

CopyRates() does need a RefreshRates()

Ah, ok - thanks!
avatar
228
jollydragon 2015.11.14 05:15 #
 

 

Thank you all ! 

Back to topics list  

To add comments, please log in or register