yes MQL4 or MQL5 ?
Hello you can take the OrderOpenTime(), and then compare it with the desired target timing interval by using one of the following functions:
https://docs.mql4.com/dateandtime
Function | Action |
Returns the last known server time (time of the last quote receipt) in the datetime format | |
Returns the local computer time in datetime format | |
Returns GMT in datetime format with the Daylight Saving Time by local time of the computer, where the client terminal is running | |
Returns the sign of Daylight Saving Time switch | |
Returns the current difference between GMT time and the local computer time in seconds, taking into account DST switch | |
Converts a datetime value into a variable of MqlDateTime structure type | |
Converts a variable of MqlDateTime structure type into a datetime value | |
Returns the current day of the month, i.e., the day of month of the last known server time | |
Returns the current zero-based day of the week of the last known server time | |
Returns the current day of the year i.e., the day of year of the last known server time | |
Returns the hour of the last known server time by the moment of the program start | |
Returns the current minute of the last known server time by the moment of the program start | |
Returns the current month as number, i.e., the number of month of the last known server time | |
Returns the amount of seconds elapsed from the beginning of the current minute of the last known server time by the moment of the program start | |
Returns the day of month of the specified date | |
Returns the zero-based day of week of the specified date | |
Returns the day of year of the specified date | |
Returns the hour of the specified time | |
Returns the minute of the specified time | |
Returns the month number of the specified time | |
Returns the amount of seconds elapsed from the beginning of the minute of the specified time | |
Returns year of the specified date | |
Returns the current year, i.e., the year of the last known server time |
- docs.mql4.com
#include <Tools\DateTime.mqh> void OnStart() { CDateTime time; time.DateTime(TimeCurrent()); Print(time.DayName()); Print(time.day); Print(time.day_of_week); Print(time.day_of_year); }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
I am trying to make a simple panel that will allow me to see the open trades taken today, but I can't seem to find code to do this. How can I determine the day a trade was opened, assuming it is still an open trade and in the terminal. I know I can use OrderOpenTime() to get the full date/time that the trade was opened on, but I'm looking to isolate only the day. Is this something we can do?
Thanks for the help.