@l-andorrà Thanks friend for replying.
I thought that there was some simple way to identify the position of each open operation, since by variables, the design becomes very extensive. And to know when the price is returned there is no problem, since this is not required, it is only knowing if the price, after having open X positions, reaches one of the first open positions, that's all.