how can i add timefilter in ea

To add comments, please log in or register
Reza Yavari Chahar Mahal Bakhtiyari
3763
Reza Yavari Chahar Mahal Bakhtiyari  
Abdul Salam:
can someone help me to add time filter in my ea.

This is a general topic, you can research it.

extern int StartHour=1;

extern int StopHour=24;

.

.

.

BuyMode= .... &&  Hour()>=StartHour  && Hour()<=StopHour;

--------------------------------------------------------------------------------

extern int StartDay=1;

extern int StopDay=31;

.

.

.

BuyMode= .... && Day()>StartDay  && Day()< StopDay ;

----------------------------------------------------------------------------------

extern int week=1;     //  (0-Sunday,1,2,3,4,5,6)

.

.

.

BuyMode= .... && DayOfWeek()==week ;


----------------------------------------------------------------------------------

Be sure to read this     https://docs.mql4.com/dateandtime

Date and Time - MQL4 Reference
Date and Time - MQL4 Reference
  • docs.mql4.com
This is the group of functions for working with data of datetime type (an integer that represents the number of seconds elapsed from 0 hours of January 1, 1970). What's new in MQL5 Thus, the new...
To add comments, please log in or register