Then you should store the ticket number of that specific position into a variable. Then use that variable to identify the position when it is closed. But I guess you will be having several open positions at the same time? Then you will need a custom array.