hrishikeshr1:
Hi all,
I need help creating a code, whereI want to close if my order is open for more than 7 days to include in my EA.
I am trying to use OderOpenTime() function but not able to calculate till current time to get the no days difference.
Please suggest some code / function where I can calculate the number of days and check with the open order date and close the trade if it is open for more than 7 days.
thanks in advance.
(TimeCurrent()-OrderOpenTime())>(7*24*3600) ... close the order
hrishikeshr1: if my order is open for more than 7 days
- Mladen Rakic's suggestion tests if the order has been open for more than seven calendar days (includes weekends/market holidays.)
- If you want trading days, then use the MT5 equivalent of iBarShift(D1)
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
Hi all,
I need help creating a code, whereI want to close if my order is open for more than 7 days to include in my EA.
I am trying to use OderOpenTime() function but not able to calculate till current time to get the no days difference.
Please suggest some code / function where I can calculate the number of days and check with the open order date and close the trade if it is open for more than 7 days.
thanks in advance.