Position model represents an open trading position in the MetaTrader 5 platform.
Properties
Position action typeAllowed values:
0- Buy1- Sell
Position volume (lot size)
Trading symbol (e.g., “EURUSD”, “GBPUSD”)
Opening price of the position
Time when the position was opened
Unique position identifier
Example
Action Values
Theaction field indicates the direction of the position:
| Value | Description |
|---|---|
| 0 | Buy (Long) |
| 1 | Sell (Short) |
Methods
The Position model provides getter and setter methods for all properties:getAction()/setAction($action)- Get/set the position action (buy/sell)getVolume()/setVolume($volume)- Get/set the position volumegetSymbol()/setSymbol($symbol)- Get/set the trading symbolgetPrice()/setPrice($price)- Get/set the opening pricegetTime()/setTime($time)- Get/set the opening timegetId()/setId($id)- Get/set the position ID