Download MetaTrader 5
MQL5 ReferenceTrade FunctionsPositionSelectByTicket 

PositionSelectByTicket

Selects an open position to work with based on the ticket number specified in the position. If successful, returns true. Returns false if the function failed. Call GetLastError() for error details.

bool  PositionSelectByTicket(
   ulong   ticket     // Position ticket
   );

Parameters

ticket

[in]  Position ticket.

Return Value

A value of the bool type.

Note

The PositionSelectByTicket() function copies position data to the program environment. Further calls of PositionGetDouble(), PositionGetInteger() and PositionGetString() return the previously copied data. Even if a position does not exist already (or its size, direction etc. has changed), the data may still be received sometimes. To make sure that you receive valid position data, it is recommended to call PositionSelect() before you access the data.

See also

PositionGetSymbol(), PositionsTotal(), Position Properties


Updated: 2016.03.15