MQL4参考 市场信息 MarketInfo

MarketInfo

Returns various data about securities listed in the "Market Watch" window.

double  MarketInfo(
   string           symbol,     // symbol
   int              type        // information type
   );

Parameters

symbol

[in]  Symbol name.

type

[in]  Request identifier that defines the type of information to be returned. Can be any of values of request identifiers.

Returned value

Returns various data about securities listed in the "Market Watch" window. A part of information about the current security is stored in predefined variables.

Example:

   double vbid    = MarketInfo("EURUSD",MODE_BID);
   double vask    = MarketInfo("EURUSD",MODE_ASK);
   double vpoint  = MarketInfo("EURUSD",MODE_POINT);
   int    vdigits = (int)MarketInfo("EURUSD",MODE_DIGITS);
   int    vspread = (int)MarketInfo("EURUSD",MODE_SPREAD);

See also

Symbol properties