# How to manage position with multiple entry?

Hello everyone, I hope you're all well 😊

Let's take a concrete example where I open 10 long positions, with a volume of 0.01 lot per position per bare, i.e. a total volume of 0.1 lot.

In order to manage the entire position efficiently, I would like to easily identify these different positions, for example to give them different stp losses or different take profits.

For example, in the comments for the PositionOpen function, I thought of putting some index-style text, for example for the first position, a message like "Long_01" and so on.

Or would you recommend array or other solutions?

Best Reguards

ZeroCafeine 🙂

Maintain a log of your positions , in arrays , or create a structure that has your entire system in there . You can save/load the list of trades (array) or the structure itself too and pick up from where you left off (but checking for whether or not positions are as you left them).

Are the positions a grid a scale in or just technical manual entries ?

How can I get tickets for positions in time order?
I've managed to retrieve the oldest one using the POSITION_TIME enumeration, but I'm still unable to do so if I have several positions

```bool GetOldestTicketPosition(ulong &posTicket01){
long OldestOne = 0.0;
for (int i = PositionsTotal() - 1 ; i >= 0; i--){
ulong positionTicket = PositionGetTicket(i);
PositionSelectByTicket(positionTicket);

datetime PosDateTime = PositionGetInteger(POSITION_TIME);
long Long_PosDateTime = (long)PosDateTime;
if (OldestOne == 0){ OldestOne = Long_PosDateTime; }

if (OldestOne <= Long_PosDateTime){
posTicket01 = positionTicket;
}
}
// Voila
return true;
}```

any help pls 😊

ZeroCafeine #:

How can I get tickets for positions in time order?
I've managed to retrieve the oldest one using the POSITION_TIME enumeration, but I'm still unable to do so if I have several positions

any help pls 😊

try this

```void RankPositions(ulong &positions[]){
ulong ranker[][2];
int co=0;
ArrayResize(ranker,PositionsTotal(),0);
for(int i=0;i<PositionsTotal();i++){
ulong ticket=PositionGetTicket(i);
if(PositionSelectByTicket(ticket)){
co++;
ranker[co-1][0]=(ulong)PositionGetInteger(POSITION_TIME);
ranker[co-1][1]=ticket;
}
}
ArrayResize(ranker,co,0);
ArraySort(ranker);
ArrayResize(positions,co,0);
for(int i=0;i<co;i++){
positions[i]=ranker[i][1];
}
}```

Lorentzos Roussos #:

try this

Excellent, thank you very much 😊

Best Regards
ZeroCafeine 😊