I would suggest doing it from OnTimer()
You need to loop through your open orders - there are plenty of examples about how to do that if you search the site.
For each open order, you check if TimeCurrent() >= OrderOpenTime() + 300
(300 seconds = 5 minutes)
If so, you close the order using OrderClose()
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I want to modify a EA so every trade will close at "X" ammount of minutes. how do you recommend going about this? what command would i use to make the program wait (e.g. 5 minutes) and then close position?
maybe Sleep(300000);
what is the command to close a position?