MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal

Automated Trading Language Documentation

Screenshot
EURUSD, H1
Real
EasyTransactionEasyTransaction Try product
EasyTransaction
Author: gcwangbing
Subscribe to signal
Vperedd
237.30%, 55 524.44 USD
Moving Mini-Max: a New Indicator for Technical Analysis and Its Implementation in MQL5 Moving Mini-Max: a New Indicator for Technical Analysis and... Interpolation Indicator
Interpolation
Author: GODZILLA

PositionGetDouble

The function returns the requested property of an open position, pre-selected using PositionGetSymbol or PositionSelect. The position property must be of the double type. There are 2 variants of the function.

1. Immediately returns the property value.

double  PositionGetDouble(
   ENUM_POSITION_PROPERTY_DOUBLE  property_id      // Property identifier
   );

2. Returns true or false, depending on the success of the function execution. If successful, the value of the property is placed in a receiving variable passed by reference by the last parameter.

bool  PositionGetDouble(
   ENUM_POSITION_PROPERTY_DOUBLE  property_id,     // Property identifier
   double&                        double_var       // Here we accept the property value
   );

Parameters

property_id

[in]  Identifier of a position property. The value can be one of the values of the ENUM_POSITION_PROPERTY_DOUBLE enumeration.

double_var

[out]  Variable of the double type, accepting the value of the requested property.

Return Value

Value of the double type. If the function fails, 0 is returned.

Note

For each symbol, at any given moment of time, only one position can be open, which is the result of one or more deals. Do not confuse positions with current pending orders, which are also displayed on the "Trade" tab of the "Toolbox" of the client terminal.

To ensure receipt of fresh data about a position, it is recommended to call PositionSelect() right before referring to them.

See also

PositionGetSymbol(), PositionSelect(), Position Properties


Updated: 2012.09.13