TimeDayOfWeek() undeclared identifier MQL5

 
#include <Tools/DateTime.mqh>

input ENUM_DAY_OF_WEEK TradingWeekdays = MONDAY;

int OnInit() 
{
if (TimeDayOfWeek() == TradingWeekdays && IsTradingHour())
    {
        // Retrieve exchange rates for EURUSD, EURGBP, and GBPUSD
        // Calculate the mean value using the formula: MEAN = EURUSD - EURGBP * GBPUSD
        // Check if the mean value exceeds the TradeTrigger

        if(OpportunityDetected())
        {
            // Execute the arbitrage trades
            ExecuteArbitrage();
        }
    }
}

I even had to explicitly include the DateTime header file which exists in my include/Tools directory just to be sure, the file  was included successfully but everytime I test the EA, it pops up: 'TimeDayOfWeek' - undeclared identifier TrinityFX EA.mq5 44 8.


 

try these

int TimeSecond(datetime time)   {MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.sec);}
int TimeMinute(datetime time)   {MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.min);}
int TimeHour(datetime time)     {MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.hour);}
int TimeDayOfWeek(datetime time){MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.day_of_week);}
int TimeDay(datetime time)      {MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.day);}
int TimeMonth(datetime time)    {MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.mon);}
int TimeYear(datetime time)     {MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.year);}
 
Lorentzos Roussos #:
int TimeDayOfWeek(datetime time){MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.day_of_week);}

It works! Thanks.
Trynna get the hang of the MQL APIs by building while learning. I'm new to this.

 
Lorentzos Roussos #:
int TimeDay(datetime time)      {MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.day);} int TimeMonth(datetime time)    {MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.mon);} int TimeYear(datetime time)     {MqlDateTime mt;bool turn=TimeToStruct(time,mt);return(mt.year);}

Just out of curiosity, are these functions not defined in the DateTime.mqh? What could be the reason that I get the undeclared indentifier?

 
Chrix Eledu #:

Just out of curiosity, are these functions not defined in the DateTime.mqh? What could be the reason that I get the undeclared indentifier?

they probably have a different name

 
Chrix Eledu #: Just out of curiosity, are these functions not defined in the DateTime.mqh?

Why didn't you look in there and find out? Do your own research.

 
William Roeder #:

Why didn't you look in there and find out? Do your own research.

you just assumed I didn't look in there, of course I searched in there found another called DayName() that still didn't work, like I said I am new to this, posting here was my last resort