what would be an alternative for DayOfWeek()

 
Hello friends,
Hope you are having a good day!
I'm a MQL4 coder and I have just started learning MQL5, I'm newbie :D
I would close open orders at 19:00 Fridays.
How can I do this with MQL5?
By MQL4 I use DayOfWeek() and Hour(), but they are gone here in MQL5 :|

Your advice is greatly appreciated.
 
HosseinKOGO: I'm a MQL4 coder and I have just started learning MQL5, I'm newbie :D. I would close open orders at 19:00 Fridays. How can I do this with MQL5? By MQL4 I use DayOfWeek() and Hour(), but they are gone here in MQL5 :|

Read the following article. You will find your answer there.

 
Fernando Carreiro #:

Read the following article. You will find your answer there.

Also look at https://www.mql5.com/en/forum/429123#comment_40958907

Very similar query - a simple solution lay in using MqlDateTime & TimeToStruct(), which can give you all the time fields you need

A question about time.....
A question about time.....
  • 2022.07.21
  • www.mql5.com
Morning All So I have a snippet of code set up to prompt a MessageBox to make itself known at a certain time (closingTime) which is formatted to an...
 
Thank you Friends,
Appreciated
 

Try this:

#include <Tools\DateTime.mqh>

CDateTime my_time;

my_time.DateTime(TimeCurrent()); //The time you assign here is put into a TimeStruct form automatically

Print((string)my_time.day_of_week; //which is public, so you can just call it.
Reason: