Download MetaTrader 5
To add comments, please log in or register
Sell your applications via the Market. It is secure!
moonsboy
889
moonsboy 2015.11.13 02: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. 

Keith Watford
Moderator
7896
Keith Watford 2015.11.13 02: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. 

honest_knave
954
honest_knave 2015.11.13 07: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));

 

Ovo Cz
2961
Ovo Cz 2015.11.13 13: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.
honest_knave
954
honest_knave 2015.11.13 13: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!

Carl Schreiber
5938
Carl Schreiber 2015.11.13 15: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?
honest_knave
954
honest_knave 2015.11.13 15:36  

CopyRates() does need a RefreshRates()

Carl Schreiber
5938
Carl Schreiber 2015.11.13 17:08  
honest_knave:

CopyRates() does need a RefreshRates()

Ah, ok - thanks!
moonsboy
889
moonsboy 2015.11.14 04:15  

Thank you all ! 

/
To add comments, please log in or register