Thanks for the reply.
I tried but the block on the left N360 Modify Varibles does not count the candles to me since it opened the trade, or at least it does not communicate it correctly to the N362 write to file block.
What I would like is that since he opens a position, he starts counting candles until he closes the position.
For example, it opens the position candle one closes after five candles, there are five candles.
At this point it tells block N362 write to file to see the highest price of the last 5 candles, and the lowest price of the last 5 candles