Get OrderId-s which belongs to a Position...

 

Hi Forum,

I have a positionId.

How can i get the orderId-s, which belongs to this position?

Thx in advance, Zoltan.

 

Perhaps this:

ORDER_POSITION_ID

Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The identifier of exactly this position is set to the executed order at this moment.


https://www.mql5.com/en/docs/constants/tradingconstants/orderproperties

Z.

Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
Documentation on MQL5: Standard Constants, Enumerations and Structures / Trade Constants / Order Properties
  • www.mql5.com
Requests to execute trade operations are formalized as orders. Each order has a variety of properties for reading. Information on them can be obtained using functions Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The...
 

aaaTriplaX: I have a positionId. How can i get the orderId-s, which belongs to this position?

Perhaps this:

ORDER_POSITION_ID

Position identifier that is set to an order as soon as it is executed. Each executed order results in a deal that opens or modifies an already existing position. The identifier of exactly this position is set to the executed order at this moment.


I position can have many Orders associated with it. It is not necessarily a one-to-one relationship.

So, you have the scan the Orders and collect the list of the ones with the same Position ID as the one you have!

Reason: