How to make an EA close a trade after a certain amount of time

Hi all,

I have an EA. The EA opens a trade according to some rules. It has take profit point and stop loss point.
I want to obtain when the EA opens a trade, if the trade isn’t closed by take profit point up to x hours, the EA must close the trade.
How can I do that?

Best.

You could use OnTimer event to run after x seconds depending on when you want the trade to close? When the timer runs, if the trade is still open, close it!