Why is there no function to convert POSITION_IDENTIFIER to POSITION_TICKET?

 
Hey everybody;)
Why is there no standard function to convert Position_Identifier to Position_Ticket because Position_Identifier stays all the time the same whereas Position_Ticket changes.
When working with an array where you store position informations relevant for your EA, you want to use the Position_Identifier since it stays the same whereas with Position_Ticket, you would have to change it each time you modify it, or external things happen.

At the moment, you have to iterate over all positions and retrieve its Position_ID, until it's matching. Then you're having the right Position_Ticket but its really inefficient.

Thanks for the thread;)
 
Please go ahead with your question.
 
Anton Frederic Burmester:
Hey everybody;)
Why is there no standard function to convert Position_Identifier to Position_Ticket because Position_Identifier stays all the time the same whereas Position_Ticket changes.
When working with an array where you store position informations relevant for your EA, you want to use the Position_Identifier since it stays the same whereas with Position_Ticket, you would have to change it each time you modify it, or external things happen.

At the moment, you have to iterate over all positions and retrieve its Position_ID, until it's matching. Then you're having the right Position_Ticket but its really inefficient.

Thanks for the thread;)

Because e.g. netting accounts have only one open position per symbol (1 ID) but multiple booking entries (each with a unique ID) increasing or decreasing the size of the one position.

On hedging accounts you can partially close a position. and again multiple entries in the history for one position.

 
Anton Frederic Burmester:
Hey everybody;)
Why is there no standard function to convert Position_Identifier to Position_Ticket because Position_Identifier stays all the time the same whereas Position_Ticket changes.
When working with an array where you store position informations relevant for your EA, you want to use the Position_Identifier since it stays the same whereas with Position_Ticket, you would have to change it each time you modify it, or external things happen.

At the moment, you have to iterate over all positions and retrieve its Position_ID, until it's matching. Then you're having the right Position_Ticket but its really inefficient.

Thanks for the thread;)

Why would you even want that?

 
Carl Schreiber #:

Because e.g. netting accounts have only one open position per symbol (1 ID) but multiple booking entries (each with a unique ID) increasing or decreasing the size of the one position.

On hedging accounts you can partially close a position. and again multiple entries in the history for one position.

And how do you then work with an array, that stores the position information? Because you would have to update the Position_Ticket in that array of that position each time after changing it.

Thanks;)

 
Anton Frederic Burmester #:

And how do you then work with an array, that stores the position information? Because you would have to update the Position_Ticket in that array of that position each time after changing it.

Thanks;)

Well, if you approach it in the other direction, then you don't need the ticket number in your array.

What I mean is, you loop through the terminals positions and get the identifier from there, then you search your array for that.

You could use a hash map or a red black tree from standard library to manage your array of positions.