To deal with times you can use my solutions:
https://www.mql5.com/en/articles/9926
https://www.mql5.com/en/articles/9929

Dealing with Time (Part 1): The Basics
- www.mql5.com
Functions and code snippets that simplify and clarify the handling of time, broker offset, and the changes to summer or winter time. Accurate timing may be a crucial element in trading. At the current hour, is the stock exchange in London or New York already open or not yet open, when does the trading time for Forex trading start and end? For a trader who trades manually and live, this is not a big problem.
aaa ggg: I am attempting to restrict the hours during which trading can occur, but I have not been successful with my attempts so far. I would appreciate any input or suggestions on how to accomplish this.
The function Hour() does not exist in MQL5. It does exist for MQL4 but it does not take any parameters — Hour - Date and Time - MQL4 Reference

aaa ggg:
I am attempting to restrict the hours during which trading can occur, but I have not been successful with my attempts so far. I would appreciate any input or suggestions on how to accomplish this.
Please check this thread:
https://www.mql5.com/en/forum/441765#comment_45023509

How Can I Set Time Only Trade On My Time
- 2023.02.15
- www.mql5.com
example 8:00 AM To 17:00PM GMT London time 13:00 To 22:00 GMT new york time...
The function Hour() does not exist in MQL5. See Migrating from MQL4 to MQL5 - MQL5 Articles № 11

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I am attempting to restrict the hours during which trading can occur, but I have not been successful with my attempts so far. I would appreciate any input or suggestions on how to accomplish this.