T is a datetime (seconds from 1970.) ENUM_DAY_OF_WEEK is an enumeration (SUNDAY, etc.) You can't cast one to the other.
Use TimeDayOfWeek
Migrating from MQL4 to
MQL5 - MQL5 Articles № 18
Hi,
i need to find our which day of the week was a previous candle in an EA MT5 start and finish time
datetime timeC[];
ArraySetAsSeries(timeC,true);
CopyTime(NULL,0,0,1000,timeC);
string t=timeC[500];
Print(EnumToString((ENUM_DAY_OF_WEEK)t)); //???????
looking for a result like Monday,tuesday,....
Please Help!
Thank you for your quick response, how do you suggest i do it? i just want to get the day name where the candle is was on the chart from timeC[500] position ?
Thank you for your quick response, how do you suggest i do it? i just want to get the day name where the candle is was on the chart from timeC[500] position ?
Here's how I would do it...
#include <Tools\DateTime.mqh> void OnStart() { datetime timeC[]; ArraySetAsSeries(timeC,true); CopyTime(_Symbol,PERIOD_D1,0,1000,timeC); CDateTime time; time.DateTime(timeC[500]); printf("%s is a %s",TimeToString(time.DateTime(),TIME_DATE),time.DayName()); }
Here's how I would do it...
Thank you so much great help :)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
i need to find our which day of the week was a previous candle in an EA MT5 start and finish time
datetime timeC[];
ArraySetAsSeries(timeC,true);
CopyTime(NULL,0,0,1000,timeC);
string t=timeC[500];
Print(EnumToString((ENUM_DAY_OF_WEEK)t)); //???????
looking for a result like Monday,tuesday,....
Please Help!