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:
TimeCurrent – OpenOrderTime = secondsElapsed
Watch the video here
Download the VTS System and EA here:
Click to download VtsPackageCloseOnProfit
Need help with the downloaded file? http://www.iexpertadvisor.com/how-do-i-open-a-vts-zip-file/
To get notified about the latest questions and answers, follow us!
Follow @iExpertAdvisor