Interaction between position open and new bars


Hello! How are you? In the past I did some questions, that I solved, but one I am trying to find the answer and... nothing, for this reason the creation of this post. 

        I want to put some conditionals for the EA to close the position immediately, since they are met, but... I can't imagine how to assign PositionGetDouble(POSITION_PRICE_OPEN) or PositionGetInteger(POSITION_TIME) to new bars, so if the 2nd or 3rd, or 5th bar do this close the position!

       I perceive that closing orders, even being possible, it's not only difficult, but also can be dangerous, generating looping orders, right? For this reason I decided to ask the community. 

       I hope you all have a marvelous day and thank you MQL5 community for the helps! Bye.