Execution of trade operations results in the opening of a position, changing of its volume and/or direction, or its disappearance. Trade operations are conducted based on orders, sent by the OrderSend() function in the form of trade requests. For each financial security (symbol) only one open position is possible. A position has a set of properties available for reading by the PositionGet...() functions.
For the function PositionGetInteger()
ENUM_POSITION_PROPERTY_INTEGER
Identifier |
Description |
Type |
POSITION_TIME |
Position open time |
datetime |
POSITION_TIME_MSC |
Position opening time in milliseconds since 01.01.1970 |
long |
POSITION_TIME_UPDATE |
Position changing time in seconds since 01.01.1970 |
long |
POSITION_TIME_UPDATE_MSC |
Position changing time in milliseconds since 01.01.1970 |
long |
POSITION_TYPE |
Position type |
|
POSITION_MAGIC |
Position magic number (see ORDER_MAGIC) |
long |
POSITION_IDENTIFIER |
Position identifier is a unique number that is assigned to every newly opened position and doesn't change during the entire lifetime of the position. Position turnover doesn't change its identifier. |
long |
For the function PositionGetDouble()
Identifier |
Description |
Type |
POSITION_VOLUME |
Position volume |
double |
POSITION_PRICE_OPEN |
Position open price |
double |
POSITION_SL |
Stop Loss level of opened position |
double |
POSITION_TP |
Take Profit level of opened position |
double |
POSITION_PRICE_CURRENT |
Current price of the position symbol |
double |
POSITION_COMMISSION |
Commission |
double |
POSITION_SWAP |
Cumulative swap |
double |
POSITION_PROFIT |
Current profit |
double |
For the function PositionGetString()
Identifier |
Description |
Type |
POSITION_SYMBOL |
Symbol of the position |
string |
POSITION_COMMENT |
Position comment |
string |
Direction of an open position (buy or sell) is defined by the value from the ENUM_POSITION_TYPE enumeration. In order to obtain the type of an open position use the PositionGetInteger() function with the POSITION_TYPE modifier.
Identifier |
Description |
POSITION_TYPE_BUY |
Buy |
POSITION_TYPE_SELL |
Sell |