limiting EA to trade of given hours and days
-
extern string StartTime = "01.00"; //EA starts hour extern string EndTime = "23:00"; //EA stops hour
When dealing with time, a lot of people use strings; they can not be optimized. Using (int) seconds or (double) hours and fraction can be inputs.
See also Dealing with Time (Part 1): The Basics - MQL5 Articles (2021.10.01)
Dealing with Time (Part 2): The Functions - MQL5 Articles (2021.10.08)
MQL5 Programming Basics: Time - MQL5 Articles (2013.04.26) Your code if((dt.day_of_week ==0 && Sunday) || ⋮ (dt.day_of_week ==6 && Saturday)) return true; return false;
Simplified return (dt.day_of_week ==0 && Sunday) || ⋮ (dt.day_of_week ==6 && Saturday);
Hi,
I'd like to confirm my logic to limiting my trading EA to given hours (start to finish) and days.
I'm grateful if someone can confirm it or correct it if there's any problem with the code above.
Thanks.