Question about tickets or id's



My question is:

The ticket (or we can say position_id) of a trade...that is a PENDING ORDER is the SAME ticket when this order is executed in the market and it becomes an OPEN POSITION?

I need this info for a robot making. I would like to know it for the correct closing of OPEN TRADES or PENDING ORDERS (when it is no executed).



Order = order id

position = position id + order id

deal = deal id + position id + order id