Use OrderOpenTime(). After the OrderSelect(). The time is calculated in seconds. How many seconds is in 2 hours? Once you find the answer to that. You ask if TimeCurrent() -
OrderOpenTime(). is greater than > or = to X.
Thank you, ubzen!
It worked! =D
Can you write the code for me, please!!!
BlueKnight:
Thank you, ubzen!
It worked! =D
xspeculator:
Can you write the code for me, please!!!
Trie to do what Ubzen wrote...
Use OrderOpenTime(). After the OrderSelect(). The time is calculated in seconds. How many seconds is in 2 hours? Once you find the answer to that. You ask if TimeCurrent() - OrderOpenTime(). is greater than > or = to X.
Means use a loop to get through the OrdersTotal()
use OrderSelect()
if TimeCurrent() - OrderOpenTime(). is greater than > or = to X. Close the trade
xspeculator:
Can you write the code for me, please!!!
Already answered Closing orders after a specified number of bars - MQL4 forum
Can you write the code for me, please!!!
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 need to close all orders older than 2 hours. Anyone know how to do this or have anything that could help?
I tried to understand the time function but it is not working, maybe I am calculating/obtaining the time incorrectly.
Any help is welcome. Thank you! =D