Which method is preferred to calculate current price

 

Hi;

There are apparently 3 choices to calculate current price.  Which one is preferred and why?


SymbolInfoDouble(Symbol(), SYMBOL_BID); 

or

MarketInfo(Symbol(), MODE_BID);

or

SymbolInfoTick(Symbol(), MODE_BID);


Appreciate an explanation.  Thanks.

 
Lode Loyens: There are apparently 3 choices to calculate current price.  Which one is preferred and why?
  1. SymbolInfoDouble imported from MT5.
  2. MarketInfo not available in MT5.
  3. SymbolInfoTick imported from MT5.
  4. Fourth choice, predefined variable Bid. Not available in MT5.
 
William Roeder #:
  1. SymbolInfoDouble imported from MT5.
  2. MarketInfo not available in MT5.
  3. SymbolInfoTick imported from MT5.
  4. Fourth choice, predefined variable Bid. Not available in MT5.

Thank you sir.  Much obliged.

 
First method is more preferable to calculate current price
Because <other things being equal> this with 100% compatibility allows to get the most compact code

For example

double ASK () { return SymbolInfoDouble ( _Symbol , SYMBOL_ASK ) ; }
double BID () { return SymbolInfoDouble ( _Symbol , SYMBOL_BID ) ; }


Reason: