tracking a trade and closing it on a specific price

 

I am creating a castom ea and i am having difficulties with implementing an exit strategy that need to track the trade and close it when it riches a specific price.

for more context this ea can have only one open trade per pear so I have to have a way for the ea to know if the specific trade is open.  Also i need the ea to modify the stop loss when it reaches a specific price so it closes when it goes back to that price like a trailing stop but not exactly. If anyone can help pls answer or massage me  

Reason: