'Hour' - wrong parameters count

 

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.


bool IsTradeTime() {

    datetime now = TimeCurrent();

    int hour = Hour(now);
 
Dealing with Time (Part 1): The Basics
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

Hour - Date and Time - MQL4 Reference
Hour - Date and Time - MQL4 Reference
  • docs.mql4.com
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
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