• Get access

Day of Week in MQL5

To add comments, please log in or register
Wolfgang
83
Wolfgang  

For a pivot indicator I need an expression to find Monday.

In MQL4 code

if (DayOfWeek() == 1) ...                

 

How do you code an expression to find the first day of the week in MQL5? 

Can you give an example? 

Rashid Umarov
Admin
16598
Rashid Umarov  
Wolfgang
83
Wolfgang  
Rosh   :
See MqlDateTime.


I looked at this link allready, but as a non -professional, only stupid trader, I need an example, which is closer to my needs.

An expression just for one day in the week.

Paul
748
Paul  
walb99   :


I looked at this link allready, but as a non -professional, only stupid trader, I need an example, which is closer to my needs.

An expression just for one day in the week.


MQL5=>MQL4 conversion functions are here https://www.mql5.com/en/forum/121011/page18

In mt4datetime.mqh:

int DayOfWeek()
{
   MqlDateTime tm;
   TimeCurrent(tm);
   return(tm.day_of_week);
}

 Paul

http://paulsfxrandomwalk.blogspot.com/ 

Beta Testing of MetaTrader 5 Has Started! - MQL4 forum
  • www.mql5.com
Beta Testing of MetaTrader 5 Has Started! - MQL4 forum
Wolfgang
83
Wolfgang  
phampton   :


MQL5=>MQL4 conversion functions are here https://www.mql5.com/en/forum/121011/page18

In mt4datetime.mqh:

 Paul

http://paulsfxrandomwalk.blogspot.com/ 


When I understand corrctly this means: I can use the old expression, with 

#include <mt4datetime.mqh>

 Compiler  shows no errors.

Hope it works

 

Thanks. 

To add comments, please log in or register