MQL4 Reference Date and Time Hour

MQL4 Help as One File:

Hour

Returns the hour (0,1,2,..23) of the last known server time by the moment of the program start.

int  Hour();

Returned value

The hour (0,1,2,..23) of the last known server time by the moment of the program start (this value will not change within the time of the program execution).

Note

At the testing, the last known server time is modelled.

Example:

  bool is_siesta=false;
  if(Hour()>=12 && Hour()<17)
     is_siesta=true;