Skip to content

Symbol Properties

Symbol Properties

Market information identifiers, used with MarketInfo() function. It can be any of the following values:

IDValueDescription
MODE_LOW1Low day price
MODE_HIGH2High day price
MODE_TIME5The last incoming tick time (last known server time)
MODE_BID9Last incoming bid price. For the current symbol, it is stored in the predefined variable Bid
MODE_ASK10Last incoming ask price. For the current symbol, it is stored in the predefined variable Ask
MODE_POINT11Point size in the quote currency. For the current symbol, it is stored in the predefined variable Point
MODE_DIGITS12Count of digits after decimal point in the symbol prices. For the current symbol, it is stored in the predefined variable Digits
MODE_SPREAD13Spread value in points
MODE_STOPLEVEL14Stop level in points

A zero value of MODE_STOPLEVEL means either absence of any restrictions on the minimal distance for Stop Loss/Take Profit or the fact that a trade server utilizes some external mechanisms for dynamic level control, which cannot be translated in the client terminal. In the second case, GetLastError() can return error 130, because MODE_STOPLEVEL is actually “floating” here. | | MODE_LOTSIZE | 15 | Lot size in the base currency | | MODE_TICKVALUE | 16 | Tick value in the deposit currency | | MODE_TICKSIZE | 17 | Tick size in points | | MODE_SWAPLONG | 18 | Swap of the buy order | | MODE_SWAPSHORT | 19 | Swap of the sell order | | MODE_STARTING | 20 | Market starting date (usually used for futures) | | MODE_EXPIRATION | 21 | Market expiration date (usually used for futures) | | MODE_TRADEALLOWED | 22 | Trade is allowed for the symbol | | MODE_MINLOT | 23 | Minimum permitted amount of a lot | | MODE_LOTSTEP | 24 | Step for changing lots | | MODE_MAXLOT | 25 | Maximum permitted amount of a lot | | MODE_SWAPTYPE | 26 | Swap calculation method. 0 - in points; 1 - in the symbol base currency; 2 - by interest; 3 - in the margin currency | | MODE_PROFITCALCMODE | 27 | Profit calculation mode. 0 - Forex; 1 - CFD; 2 - Futures | | MODE_MARGINCALCMODE | 28 | Margin calculation mode. 0 - Forex; 1 - CFD; 2 - Futures; 3 - CFD for indices | | MODE_MARGININIT | 29 | Initial margin requirements for 1 lot | | MODE_MARGINMAINTENANCE | 30 | Margin to maintain open orders calculated for 1 lot | | MODE_MARGINHEDGED | 31 | Hedged margin calculated for 1 lot | | MODE_MARGINREQUIRED | 32 | Free margin required to open 1 lot for buying | | MODE_FREEZELEVEL | 33 | Order freeze level in points. If the execution price lies within the range defined by the freeze level, the order cannot be modified, cancelled or closed | | MODE_CLOSEBY_ALLOWED | 34 | Allowed using OrderCloseBy() to close opposite orders on a specified symbol |

Example:

//+------------------------------------------------------------------+
//| The script prints information on symbol                          |
//+------------------------------------------------------------------+
void OnStart()
  {
   Print("Symbol=",Symbol());
   Print("Low day price=",MarketInfo(Symbol(),MODE_LOW));
   Print("High day price=",MarketInfo(Symbol(),MODE_HIGH));
   Print("The last incoming tick time=",(MarketInfo(Symbol(),MODE_TIME)));
   Print("Last incoming bid price=",MarketInfo(Symbol(),MODE_BID));
   Print("Last incoming ask price=",MarketInfo(Symbol(),MODE_ASK));
   Print("Point size in the quote currency=",MarketInfo(Symbol(),MODE_POINT));
   Print("Digits after decimal point=",MarketInfo(Symbol(),MODE_DIGITS));
   Print("Spread value in points=",MarketInfo(Symbol(),MODE_SPREAD));
   Print("Stop level in points=",MarketInfo(Symbol(),MODE_STOPLEVEL));
   Print("Lot size in the base currency=",MarketInfo(Symbol(),MODE_LOTSIZE));
   Print("Tick value in the deposit currency=",MarketInfo(Symbol(),MODE_TICKVALUE));
   Print("Tick size in points=",MarketInfo(Symbol(),MODE_TICKSIZE));
   Print("Swap of the buy order=",MarketInfo(Symbol(),MODE_SWAPLONG));
   Print("Swap of the sell order=",MarketInfo(Symbol(),MODE_SWAPSHORT));
   Print("Market starting date (for futures)=",MarketInfo(Symbol(),MODE_STARTING));
   Print("Market expiration date (for futures)=",MarketInfo(Symbol(),MODE_EXPIRATION));
   Print("Trade is allowed for the symbol=",MarketInfo(Symbol(),MODE_TRADEALLOWED));
   Print("Minimum permitted amount of a lot=",MarketInfo(Symbol(),MODE_MINLOT));
   Print("Step for changing lots=",MarketInfo(Symbol(),MODE_LOTSTEP));
   Print("Maximum permitted amount of a lot=",MarketInfo(Symbol(),MODE_MAXLOT));
   Print("Swap calculation method=",MarketInfo(Symbol(),MODE_SWAPTYPE));
   Print("Profit calculation mode=",MarketInfo(Symbol(),MODE_PROFITCALCMODE));
   Print("Margin calculation mode=",MarketInfo(Symbol(),MODE_MARGINCALCMODE));
   Print("Initial margin requirements for 1 lot=",MarketInfo(Symbol(),MODE_MARGININIT));
   Print("Margin to maintain open orders calculated for 1 lot=",MarketInfo(Symbol(),MODE_MARGINMAINTENANCE));
   Print("Hedged margin calculated for 1 lot=",MarketInfo(Symbol(),MODE_MARGINHEDGED));
   Print("Free margin required to open 1 lot for buying=",MarketInfo(Symbol(),MODE_MARGINREQUIRED));
   Print("Order freeze level in points=",MarketInfo(Symbol(),MODE_FREEZELEVEL));
  }

To obtain the current market information there are several functions: SymbolInfoInteger(), SymbolInfoDouble() and SymbolInfoString(). The first parameter is the symbol name, the values of the second function parameter can be one of the identifiers of ENUM_SYMBOL_INFO_INTEGER, ENUM_SYMBOL_INFO_DOUBLE and ENUM_SYMBOL_INFO_STRING.

For function SymbolInfoInteger():

ENUM_SYMBOL_INFO_INTEGER

IdentifierDescriptionType
SYMBOL_SELECTSymbol is selected in Market Watch.

Some symbols can be hidden in Market Watch, but still they are considered as selected. | bool | | SYMBOL_VISIBLE | Symbol is visible in Market Watch.

Some symbols (mostly, these are cross rates required for calculation of margin requirements or profits in deposit currency) are selected automatically, but generally are not visible in Market Watch. To be displayed such symbols have to be explicitly selected. | bool | | SYMBOL_SESSION_DEALS | Not supported | long | | SYMBOL_SESSION_BUY_ORDERS | Not supported | long | | SYMBOL_SESSION_SELL_ORDERS | Not supported | long | | SYMBOL_VOLUME | Not supported | long | | SYMBOL_VOLUMEHIGH | Not supported | long | | SYMBOL_VOLUMELOW | Not supported | long | | SYMBOL_TIME | Time of the last quote | datetime | | SYMBOL_DIGITS | Digits after a decimal point | int | | SYMBOL_SPREAD_FLOAT | Indication of a floating spread | bool | | SYMBOL_SPREAD | Spread value in points | int | | SYMBOL_TRADE_CALC_MODE | Contract price calculation mode | int | | SYMBOL_TRADE_MODE | Order execution type | ENUM_SYMBOL_TRADE_MODE | | SYMBOL_START_TIME | Date of the symbol trade beginning (usually used for futures) | datetime | | SYMBOL_EXPIRATION_TIME | Date of the symbol trade end (usually used for futures) | datetime | | SYMBOL_TRADE_STOPS_LEVEL | Minimal indention in points from the current close price to place Stop orders | int | | SYMBOL_TRADE_FREEZE_LEVEL | Distance to freeze trade operations in points | int | | SYMBOL_TRADE_EXEMODE | Deal execution mode | ENUM_SYMBOL_TRADE_EXECUTION | | SYMBOL_SWAP_MODE | Swap calculation model | int | | SYMBOL_SWAP_ROLLOVER3DAYS | Day of week to charge 3 days swap rollover | ENUM_DAY_OF_WEEK | | SYMBOL_EXPIRATION_MODE | Not supported | int | | SYMBOL_FILLING_MODE | Not supported | int | | SYMBOL_ORDER_MODE | Not supported | int |

For function SymbolInfoDouble():

ENUM_SYMBOL_INFO_DOUBLE

IdentifierDescriptionType
SYMBOL_BIDBid - best sell offerdouble
SYMBOL_BIDHIGHNot supporteddouble
SYMBOL_BIDLOWNot supporteddouble
SYMBOL_ASKAsk - best buy offerdouble
SYMBOL_ASKHIGHNot supporteddouble
SYMBOL_ASKLOWNot supporteddouble
SYMBOL_LASTNot supporteddouble
SYMBOL_LASTHIGHNot supporteddouble
SYMBOL_LASTLOWNot supporteddouble
SYMBOL_POINTSymbol point valuedouble
SYMBOL_TRADE_TICK_VALUEValue of SYMBOL_TRADE_TICK_VALUE_PROFITdouble
SYMBOL_TRADE_TICK_VALUE_PROFITNot supporteddouble
SYMBOL_TRADE_TICK_VALUE_LOSSNot supporteddouble
SYMBOL_TRADE_TICK_SIZEMinimal price changedouble
SYMBOL_TRADE_CONTRACT_SIZETrade contract sizedouble
SYMBOL_VOLUME_MINMinimal volume for a dealdouble
SYMBOL_VOLUME_MAXMaximal volume for a dealdouble
SYMBOL_VOLUME_STEPMinimal volume change step for deal executiondouble
SYMBOL_VOLUME_LIMITNot supporteddouble
SYMBOL_SWAP_LONGBuy order swap valuedouble
SYMBOL_SWAP_SHORTSell order swap valuedouble
SYMBOL_MARGIN_INITIALInitial margin means the amount in the margin currency required for opening an order with the volume of one lot. It is used for checking a client’s assets when he or she enters the market.double
SYMBOL_MARGIN_MAINTENANCEThe maintenance margin. If it is set, it sets the margin amount in the margin currency of the symbol, charged from one lot. It is used for checking a client’s assets when his/her account state changes. If the maintenance margin is equal to 0, the initial margin is used.double
SYMBOL_MARGIN_LONGNot supporteddouble
SYMBOL_MARGIN_SHORTNot supporteddouble
SYMBOL_MARGIN_LIMITNot supporteddouble
SYMBOL_MARGIN_STOPNot supporteddouble
SYMBOL_MARGIN_STOPLIMITNot supporteddouble
SYMBOL_SESSION_VOLUMENot supporteddouble
SYMBOL_SESSION_TURNOVERNot supporteddouble
SYMBOL_SESSION_INTERESTNot supporteddouble
SYMBOL_SESSION_BUY_ORDERS_VOLUMENot supporteddouble
SYMBOL_SESSION_SELL_ORDERS_VOLUMENot supporteddouble
SYMBOL_SESSION_OPENNot supporteddouble
SYMBOL_SESSION_CLOSENot supporteddouble
SYMBOL_SESSION_AWNot supporteddouble
SYMBOL_SESSION_PRICE_SETTLEMENTNot supporteddouble
SYMBOL_SESSION_PRICE_LIMIT_MINNot supporteddouble
SYMBOL_SESSION_PRICE_LIMIT_MAXNot supporteddouble

For function SymbolInfoString():

ENUM_SYMBOL_INFO_STRING

IdentifierDescriptionType
SYMBOL_CURRENCY_BASEBasic currency of a symbolstring
SYMBOL_CURRENCY_PROFITProfit currencystring
SYMBOL_CURRENCY_MARGINMargin currencystring
SYMBOL_DESCRIPTIONSymbol descriptionstring
SYMBOL_PATHPath in the symbol treestring

There are several symbol trading modes. Information about trading modes of a certain symbol is reflected in the values of enumeration ENUM_SYMBOL_TRADE_MODE.

ENUM_SYMBOL_TRADE_MODE

IdentifierDescription
SYMBOL_TRADE_MODE_DISABLEDTrade is disabled for the symbol
SYMBOL_TRADE_MODE_LONGONLY*Allowed only long positions
SYMBOL_TRADE_MODE_SHORTONLY*Allowed only short positions
SYMBOL_TRADE_MODE_CLOSEONLYAllowed only position close operations
SYMBOL_TRADE_MODE_FULLNo trade restrictions

Possible deal execution modes for a certain symbol are defined in enumeration ENUM_SYMBOL_TRADE_EXECUTION.

ENUM_SYMBOL_TRADE_EXECUTION

IdentifierDescription
SYMBOL_TRADE_EXECUTION_REQUESTExecution by request
SYMBOL_TRADE_EXECUTION_INSTANTInstant execution
SYMBOL_TRADE_EXECUTION_MARKETMarket execution
SYMBOL_TRADE_EXECUTION_EXCHANGE*Exchange execution

*These values are not used in MQL4 (added for compatibility with MQL5).

Values of the ENUM_DAY_OF_WEEK enumeration are used for specifying days of week.

ENUM_DAY_OF_WEEK

IdentifierDescription
SUNDAYSunday
MONDAYMonday
TUESDAYTuesday
WEDNESDAYWednesday
THURSDAYThursday
FRIDAYFriday
SATURDAYSaturday
Last updated on