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()
Identifier |
Description |
Type |
SYMBOL_SELECT |
Symbol is selected in Market Watch |
bool |
SYMBOL_VOLUME |
Volume of the last deal |
long |
SYMBOL_VOLUMEHIGH |
Maximal day volume |
long |
SYMBOL_VOLUMELOW |
Minimal day volume |
long |
SYMBOL_VOLUMEBID |
Volume for current Bid |
long |
SYMBOL_VOLUMEASK |
Volume for current Ask |
long |
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 |
|
SYMBOL_TRADE_MODE |
Order execution type |
|
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 |
|
SYMBOL_SWAP_MODE |
Swap calculation model |
|
SYMBOL_SWAP_ROLLOVER3DAYS |
Weekday to charge 3 days swap rollover |
|
SYMBOL_EXPIRATION_MODE |
Flags of allowed order expiration modes |
int |
SYMBOL_FILLING_MODE |
Flags of allowed order filling modes |
int |
For function SymbolInfoDouble()
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_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 total volume of the open position and pending orders (regardless of direction) for one symbol |
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 its 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_LONG |
Rate of margin charging on long positions |
double |
SYMBOL_MARGIN_SHORT |
Rate of margin charging on short positions |
double |
SYMBOL_MARGIN_LIMIT |
Rate of margin charging on Limit orders |
double |
SYMBOL_MARGIN_STOP |
Rate of margin charging on Stop orders |
double |
SYMBOL_MARGIN_STOPLIMIT |
Rate of margin charging on Stop Limit orders |
double |
For function SymbolInfoString()
Identifier |
Description |
Type |
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_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_SRECIFIED. 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_SRECIFIED 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_SRECIFIED |
4 |
The expiration time is specified in the order |
Example:
//+------------------------------------------------------------------+ |
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_ALL_OR_NONE|SYMBOL_CANCEL_REMAIND. 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.
Identifier |
Value |
Description |
SYMBOL_FILLING_ALL_OR_NONE |
1 |
"All or none". If the volume specified in the order with the specified price cannot be fully filled, the order is canceled and the deal is not conducted |
SYMBOL_CANCEL_REMAIND |
2 |
If only part of the specified volume can be filled, the deal for the available volume will be executed. The order remainder is canceled, and the new order is not placed |
SYMBOL_RETURN_REMAIND |
4 |
A deal is executed for the available volume. A new order at the same price is set for the remainder |
Example:
//+------------------------------------------------------------------+ |
The ENUM_SYMBOL_CALC_MODE enumeration is used for obtaining information about how the margin requirements for a symbol are calculated.
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 |
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.
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.
Identifier |
Description |
SYMBOL_TRADE_EXECUTION_REQUEST |
Execution by request |
SYMBOL_TRADE_EXECUTION_INSTANT |
Instant execution |
SYMBOL_TRADE_EXECUTION_MARKET |
Market execution |
Methods of swap calculation at position transfer are specified in enumeration ENUM_SYMBOL_SWAP_MODE.
Identifier |
Description |
SYMBOL_SWAP_MODE_DISABLED |
Swap mode disabled (no swaps) |
SYMBOL_SWAP_MODE_BY_POINTS |
Swaps in points |
SYMBOL_SWAP_MODE_BY_MONEY |
Swaps in money, its value is specified in the symbol properties in the deposit currency |
SYMBOL_SWAP_MODE_BY_INTEREST |
Swaps in yearly percents (bank mode - 360 days in a year) |
SYMBOL_SWAP_MODE_BY_MARGIN_CURRENCY |
Swaps in money, its value is specified in the symbol properties in the margin currency |
Values of the ENUM_DAY_OF_WEEK enumeration are used for specifying weekdays.
Identifier |
Description |
SUNDAY |
Sunday |
MONDAY |
Monday |
TUESDAY |
Tuesday |
WEDNESDAY |
Wednesday |
THURSDAY |
Thursday |
FRIDAY |
Friday |
SATURDAY |
Saturday |
© 2000-2010, MetaQuotes Software Corp.