Download MetaTrader 5

Symbol Properties

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

Identifier

Description

Type

SYMBOL_SELECT

Symbol is selected in Market Watch

bool

SYMBOL_SESSION_DEALS

Number of deals in the current session

long

SYMBOL_SESSION_BUY_ORDERS

Number of Buy orders at the moment

long

SYMBOL_SESSION_SELL_ORDERS

Number of Sell orders at the moment

long

SYMBOL_VOLUME

Volume of the last deal

long

SYMBOL_VOLUMEHIGH

Maximal day volume

long

SYMBOL_VOLUMELOW

Minimal day volume

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_TICKS_BOOKDEPTH

Maximal number of requests shown in Depth of Market. For symbols that have no queue of requests, the value is equal to zero.

int

SYMBOL_TRADE_CALC_MODE

Contract price calculation mode

ENUM_SYMBOL_CALC_MODE

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

ENUM_SYMBOL_SWAP_MODE

SYMBOL_SWAP_ROLLOVER3DAYS

Day of week to charge 3 days swap rollover

ENUM_DAY_OF_WEEK

SYMBOL_EXPIRATION_MODE

Flags of allowed order expiration modes

int

SYMBOL_FILLING_MODE

Flags of allowed order filling modes

int

SYMBOL_ORDER_MODE

Flags of allowed order types

int

SYMBOL_OPTION_MODE

Option type

ENUM_SYMBOL_OPTION_MODE

SYMBOL_OPTION_RIGHT

Option right (Call/Put)

ENUM_SYMBOL_OPTION_RIGHT

For function SymbolInfoDouble()

ENUM_SYMBOL_INFO_DOUBLE

Identifier

Description

Type

SYMBOL_BID

Bid - best sell offer

double

SYMBOL_BIDHIGH

Maximal Bid of the day

double

SYMBOL_BIDLOW

Minimal Bid of the day

double

SYMBOL_ASK

Ask - best buy offer

double

SYMBOL_ASKHIGH

Maximal Ask of the day

double

SYMBOL_ASKLOW

Minimal Ask of the day

double

SYMBOL_LAST

Price of the last deal

double

SYMBOL_LASTHIGH

Maximal Last of the day

double

SYMBOL_LASTLOW

Minimal Last of the day

double

SYMBOL_OPTION_STRIKE

The strike price of an option. The price at which an option buyer can buy (in a Call option) or sell (in a Put option) the underlying asset, and the option seller is obliged to sell or buy the appropriate amount of the underlying asset.

double

SYMBOL_POINT

Symbol point value

double

SYMBOL_TRADE_TICK_VALUE

Value of SYMBOL_TRADE_TICK_VALUE_PROFIT

double

SYMBOL_TRADE_TICK_VALUE_PROFIT

Calculated tick price for a profitable position

double

SYMBOL_TRADE_TICK_VALUE_LOSS

Calculated tick price for a losing position

double

SYMBOL_TRADE_TICK_SIZE

Minimal price change

double

SYMBOL_TRADE_CONTRACT_SIZE

Trade contract size

double

SYMBOL_VOLUME_MIN

Minimal volume for a deal

double

SYMBOL_VOLUME_MAX

Maximal volume for a deal

double

SYMBOL_VOLUME_STEP

Minimal volume change step for deal execution

double

SYMBOL_VOLUME_LIMIT

Maximum allowed aggregate volume of an open position and pending orders in one direction (buy or sell) for the symbol. For example, with the limitation of 5 lots, you can have an open buy position with the volume of 5 lots and place a pending order Sell Limit with the volume of 5 lots. But in this case you cannot place a Buy Limit pending order (since the total volume in one direction will exceed the limitation) or place Sell Limit with the volume more than 5 lots.

double

SYMBOL_SWAP_LONG

Long swap value

double

SYMBOL_SWAP_SHORT

Short swap value

double

SYMBOL_MARGIN_INITIAL

Initial margin means the amount in the margin currency required for opening a position 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_MAINTENANCE

The 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_SESSION_VOLUME

Summary volume of current session deals

double

SYMBOL_SESSION_TURNOVER

Summary turnover of the current session

double

SYMBOL_SESSION_INTEREST

Summary open interest

double

SYMBOL_SESSION_BUY_ORDERS_VOLUME

Current volume of Buy orders

double

SYMBOL_SESSION_SELL_ORDERS_VOLUME

Current volume of Sell orders

double

SYMBOL_SESSION_OPEN

Open price of the current session

double

SYMBOL_SESSION_CLOSE

Close price of the current session

double

SYMBOL_SESSION_AW

Average weighted price of the current session

double

SYMBOL_SESSION_PRICE_SETTLEMENT

Settlement price of the current session

double

SYMBOL_SESSION_PRICE_LIMIT_MIN

Minimal price of the current session

double

SYMBOL_SESSION_PRICE_LIMIT_MAX

Maximal price of the current session

double

SYMBOL_MARGIN_HEDGED

Contract size or margin value per one lot of hedged positions (oppositely directed positions of one symbol). Two margin calculation methods are possible for hedged positions. The calculation method is defined by the broker.

 

Basic calculation:

  • If the initial margin (SYMBOL_MARGIN_INITIAL) is specified for a symbol, the hedged margin is specified as an absolute value (in monetary terms).
  • If the initial margin is not specified (equal to 0), SYMBOL_MARGIN_HEDGED is equal to the size of the contract, that will be used to calculate the margin by the appropriate formula in accordance with the type of the financial instrument (SYMBOL_TRADE_CALC_MODE).

 

Calculation for the largest position:

  • The SYMBOL_MARGIN_HEDGED value is not taken into account.
  • The volume of all short and all long positions of a symbol is calculated.
  • For each direction, a weighted average open price and a weighted average rate of conversion to the deposit currency is calculated.
  • Next, using the appropriate formula chosen in accordance with the symbol type (SYMBOL_TRADE_CALC_MODE) the margin is calculate for the shot and the long part.
  • The largest one of the values is used as the margin.

double

For function SymbolInfoString()

ENUM_SYMBOL_INFO_STRING

Identifier

Description

Type

SYMBOL_BASIS

The underlying asset of a derivative

string

SYMBOL_CURRENCY_BASE

Basic currency of a symbol

string

SYMBOL_CURRENCY_PROFIT

Profit currency

string

SYMBOL_CURRENCY_MARGIN

Margin currency

string

SYMBOL_BANK

Feeder of the current quote

string

SYMBOL_DESCRIPTION

Symbol description

string

SYMBOL_ISIN

The name of a symbol in the ISIN system (International Securities Identification Number). The International Securities Identification Number is a 12-digit alphanumeric code that uniquely identifies a security. The presence of this symbol property is determined on the side of a trade server.

string

SYMBOL_PATH

Path in the symbol tree

string

 

For each symbol several expiration modes of pending orders can be specified. A flag is matched to each mode. Flags can be combined using the operation of logical OR (|), for example, SYMBOL_EXPIRATION_GTC|SYMBOL_EXPIRATION_SPECIFIED. In order to check whether a certain mode is allowed for the symbol, the result of the logical AND (&) should be compared to the mode flag.

If flag SYMBOL_EXPIRATION_SPECIFIED is specified for a symbol, then while sending a pending order, you may specify the moment this pending order is valid till.

Identifier

Value

Description

SYMBOL_EXPIRATION_GTC

1

The order is valid during the unlimited time period, until it is explicitly canceled

SYMBOL_EXPIRATION_DAY

2

The order is valid till the end of the day

SYMBOL_EXPIRATION_SPECIFIED

4

The expiration time is specified in the order

SYMBOL_EXPIRATION_SPECIFIED_DAY

8

The expiration date is specified in the order

Example:

//+------------------------------------------------------------------+
//| Checks if the specified expiration mode is allowed               |
//+------------------------------------------------------------------+
bool IsExpirationTypeAllowed(string symbol,int exp_type)
  {
//--- Obtain the value of the property that describes allowed expiration modes
   int expiration=(int)SymbolInfoInteger(symbol,SYMBOL_EXPIRATION_MODE);
//--- Return true, if mode exp_type is allowed
   return((expiration&exp_type)==exp_type);
  }

 

When sending an order, you can specify the filling policy for the volume set in the order. Allowed order filling modes for each symbol are specified in the table. You can set several modes for one symbol by combining flags. The flags can be combined by the operation of the logical OR (|), for example, SYMBOL_FILLING_FOK|SYMBOL_FILLING_IOC.  In order to check whether a certain mode is allowed for the symbol, the result of the logical AND (&) should be compared to the mode flag.

Fill Policy

Identifier

Value

Description

Fill or Kill

SYMBOL_FILLING_FOK

1

This policy means that a deal can be executed only with the specified volume. If the necessary amount of a financial instrument is currently unavailable in the market, the order will not be executed. The required volume can be filled using several offers available on the market at the moment.

Immediate or Cancel

SYMBOL_FILLING_IOC

2

In this case a trader agrees to execute a deal with the volume maximally available in the market within that indicated in the order. In case the order cannot be filled completely, the available volume of the order will be filled, and the remaining volume will be canceled. The possibility of using IOC orders is determined at the trade server.

Return

No identifier

 

This policy is used only for market orders (Buy and Sell), limit and stop limit orders and only for the symbols with Market or Exchange execution. In case of partial filling a market or limit order with remaining volume is not canceled but processed further.

In the Request and Instant execution modes the Fill or Kill policy is always used for market orders, and the Return policy is always used for limit orders. In this case, when sending orders using OrderSend or OrderSendAsync, there is no need to specify a fill policy for them.

In the Market and Exchange execution modes the Return policy is always allowed for all the order types. To find out whether the other policies are allowed, use the SYMBOL_FILLING_FOK and SYMBOL_FILLING_IOC properties.

Example:

//+------------------------------------------------------------------+
//| Checks if the specified filling mode is allowed                  |
//+------------------------------------------------------------------+
bool IsFillingTypeAllowed(string symbol,int fill_type)
  {
//--- Obtain the value of the property that describes allowed filling modes
   int filling=(int)SymbolInfoInteger(symbol,SYMBOL_FILLING_MODE);
//--- Return true, if mode fill_type is allowed
   return((filling & fill_type)==fill_type);
  }

 

When sending a trade request using OrderSend() function, an order type from ENUM_ORDER_TYPE enumeration should be specified for some operations. Not all types of orders may be allowed for a specific symbol. SYMBOL_ORDER_MODE property describes the flags of the allowed order types.

Identifier

Value

Description

SYMBOL_ORDER_MARKET

1

Market orders are allowed (Buy and Sell)

SYMBOL_ORDER_LIMIT

2

Limit orders are allowed (Buy Limit and Sell Limit)

SYMBOL_ORDER_STOP

4

Stop orders are allowed (Buy Stop and Sell Stop)

SYMBOL_ORDER_STOP_LIMIT

8

Stop-limit orders are allowed (Buy Stop Limit and Sell Stop Limit)

SYMBOL_ORDER_SL

16

Stop Loss is allowed

SYMBOL_ORDER_TP

32

Take Profit is allowed

Example:

//+------------------------------------------------------------------+
//| The function prints out order types allowed for a symbol         |
//+------------------------------------------------------------------+
void Check_SYMBOL_ORDER_MODE(string symbol)
  {
//--- receive the value of the property describing allowed order types
   int symbol_order_mode=(int)SymbolInfoInteger(symbol,SYMBOL_ORDER_MODE);
//--- check for market orders (Market Execution)
   if((SYMBOL_ORDER_MARKET&symbol_order_mode)==SYMBOL_ORDER_MARKET)
      Print(symbol+": Market orders are allowed (Buy and Sell)");
//--- check for Limit orders
   if((SYMBOL_ORDER_LIMIT&symbol_order_mode)==SYMBOL_ORDER_LIMIT)
      Print(symbol+": Buy Limit and Sell Limit orders are allowed");
//--- check for Stop orders
   if((SYMBOL_ORDER_STOP&symbol_order_mode)==SYMBOL_ORDER_STOP)
      Print(symbol+": Buy Stop and Sell Stop orders are allowed");
//--- check for Stop Limit orders
   if((SYMBOL_ORDER_STOP_LIMIT&symbol_order_mode)==SYMBOL_ORDER_STOP_LIMIT)
      Print(symbol+": Buy Stop Limit and Sell Stop Limit orders are allowed");
//--- check if placing a Stop Loss orders is allowed
   if((SYMBOL_ORDER_SL&symbol_order_mode)==SYMBOL_ORDER_SL)
      Print(symbol+": Stop Loss orders are allowed");
//--- check if placing a Take Profit orders is allowed
   if((SYMBOL_ORDER_TP&symbol_order_mode)==SYMBOL_ORDER_TP)
      Print(symbol+": Take Profit orders are allowed");
//---
  }

 

The ENUM_SYMBOL_CALC_MODE enumeration is used for obtaining information about how the margin requirements for a symbol are calculated.

ENUM_SYMBOL_CALC_MODE

Identifier

Description

Formula

SYMBOL_CALC_MODE_FOREX

Forex mode - calculation of profit and margin for Forex

Margin:  Lots*Contract_Size/Leverage

Profit:   (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_FUTURES

Futures mode - calculation of margin and profit for futures

Margin: Lots *InitialMargin*Percentage/100

Profit:  (close_price-open_price)*TickPrice/TickSize*Lots

SYMBOL_CALC_MODE_CFD

CFD mode - calculation of margin and profit for CFD

Margin: Lots *ContractSize*MarketPrice*Percentage/100

Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFDINDEX

CFD index mode - calculation of margin and profit for CFD by indexes

Margin: (Lots*ContractSize*MarketPrice)*TickPrice/TickSize

Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_CFDLEVERAGE

CFD Leverage mode - calculation of margin and profit for CFD at leverage trading

Margin: (Lots*ContractSize*MarketPrice*Percentage)/Leverage

Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_EXCH_STOCKS

Exchange mode — calculation of margin and profit for trading securities on a stock exchange

Margin: Lots*ContractSize*OpenPrice

Profit:  (close_price-open_price)*Contract_Size*Lots

SYMBOL_CALC_MODE_EXCH_FUTURES

Futures mode —  calculation of margin and profit for trading futures contracts on a stock exchange

Margin: Lots*InitialMargin or Lots*MaintenanceMargin

Profit:  (close_price-open_price)*Lots*TickPrice/TickSize

SYMBOL_CALC_MODE_EXCH_FUTURES_FORTS

FORTS Futures mode —  calculation of margin and profit for trading futures contracts on FORTS. The margin may be reduced by the amount of MarginDiscount deviation according to the following rules:

1. If the price of a long position (buy order) is less than the estimated price, MarginDiscount = Lots*((PriceSettle-PriceOrder)*TickPrice/TickSize)

2. If the price of a short position (sell order) exceeds the estimated price, MarginDiscount = Lots*((PriceOrder-PriceSettle)*TickPrice/TickSize)

where:

    • PriceSettle — estimated (clearing) price of the previous session;
    • PriceOrder — average weighted position price or open price set in the order (request);
    • TickPrice — tick price (cost of the price change by one point)
    • TickSize — tick size (minimum price change step)

Margin: Lots*InitialMargin or Lots*MaintenanceMargin

Profit:  (close_price-open_price)*Lots*TickPrice/TickSize

SYMBOL_CALC_MODE_SERV_COLLATERAL

Collateral mode - a symbol is used as a non-tradable asset on a trading account. The market value of an open position is calculated based on the volume, current market price, contract size and liquidity ratio. The value is included into Assets, which are added to Equity. Open positions of such symbols increase the Free Margin amount and are used as additional margin (collateral) for open positions of tradable instruments.

Margin: no

Profit:  no

Market Value: Lots*ContractSize*MarketPrice*LiqudityRate

 

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

Identifier

Description

SYMBOL_TRADE_MODE_DISABLED

Trade is disabled for the symbol

SYMBOL_TRADE_MODE_LONGONLY

Allowed only long positions

SYMBOL_TRADE_MODE_SHORTONLY

Allowed only short positions

SYMBOL_TRADE_MODE_CLOSEONLY

Allowed only position close operations

SYMBOL_TRADE_MODE_FULL

No trade restrictions

 

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

ENUM_SYMBOL_TRADE_EXECUTION

Identifier

Description

SYMBOL_TRADE_EXECUTION_REQUEST

Execution by request

SYMBOL_TRADE_EXECUTION_INSTANT

Instant execution

SYMBOL_TRADE_EXECUTION_MARKET

Market execution

SYMBOL_TRADE_EXECUTION_EXCHANGE

Exchange execution

 

Methods of swap calculation at position transfer are specified in enumeration ENUM_SYMBOL_SWAP_MODE. The method of swap calculation determines the units of measure of the SYMBOL_SWAP_LONG and SYMBOL_SWAP_SHORT parameters. For example, if swaps are charged in the client deposit currency, then the values of those parameters are specified as an amount of money in the client deposit currency.

ENUM_SYMBOL_SWAP_MODE

Identifier

Description

SYMBOL_SWAP_MODE_DISABLED

Swaps disabled (no swaps)

SYMBOL_SWAP_MODE_POINTS

Swaps are charged in points

SYMBOL_SWAP_MODE_CURRENCY_SYMBOL

Swaps are charged in money in base currency of the symbol

SYMBOL_SWAP_MODE_CURRENCY_MARGIN

Swaps are charged in money in margin currency of the symbol

SYMBOL_SWAP_MODE_CURRENCY_DEPOSIT

Swaps are charged in money, in client deposit currency

SYMBOL_SWAP_MODE_INTEREST_CURRENT

Swaps are charged as the specified annual interest from the instrument price at calculation of swap (standard bank year is 360 days)

SYMBOL_SWAP_MODE_INTEREST_OPEN

Swaps are charged as the specified annual interest from the open price of position (standard bank year is 360 days)

SYMBOL_SWAP_MODE_REOPEN_CURRENT

Swaps are charged by reopening positions. At the end of a trading day the position is closed. Next day it is reopened by the close price +/- specified number of points (parameters SYMBOL_SWAP_LONG and SYMBOL_SWAP_SHORT)

SYMBOL_SWAP_MODE_REOPEN_BID

Swaps are charged by reopening positions. At the end of a trading day the position is closed. Next day it is reopened by the current Bid price +/- specified number of points (parameters SYMBOL_SWAP_LONG and SYMBOL_SWAP_SHORT)

 

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

ENUM_DAY_OF_WEEK

Identifier

Description

SUNDAY

Sunday

MONDAY

Monday

TUESDAY

Tuesday

WEDNESDAY

Wednesday

THURSDAY

Thursday

FRIDAY

Friday

SATURDAY

Saturday

 

An option is a contract, which gives the right, but not the obligation, to buy or sell an underlying asset (goods, stocks, futures, etc.) at a specified price on or before a specific date. The following enumerations describe option properties, including the option type and the right arising from it.

ENUM_SYMBOL_OPTION_RIGHT

Identifier

Description

SYMBOL_OPTION_RIGHT_CALL

A call option gives you the right to buy an asset at a specified price

SYMBOL_OPTION_RIGHT_PUT

A put option gives you the right to sell an asset at a specified price

 

ENUM_SYMBOL_OPTION_MODE

Identifier

Description

SYMBOL_OPTION_MODE_EUROPEAN

European option may only be exercised on a specified date (expiration, execution date, delivery date)

SYMBOL_OPTION_MODE_AMERICAN

American option may be exercised on any trading day on or before expiry. The period within which a buyer can exercise the option is specified for it


Updated: 2016.02.23