Q: How can I close a buy trade after 240 seconds if it’s not over the first trailing step (60)?
A: I created a video to show you how this is done. Also, the system can be downloaded below.
A few notes:
The function “fnGetOrderInfo” is used to get almost any information about an open order, including the open time, and the amount of profit.
Most “times” in MQL are saved in seconds. TimeCurrent is in seconds and so it the OpenOrder time. So if we subtract TimeCurrent (right now) from when the time the order was opened, we’ll have the elapsed seconds since the order was opened: