A simpler way to get Hour() value

David Diez  

How to write this on MQ5?

if(Spread<MaxSpread&&Hour()>=StartHour&&Hour()<StopHour){

Thank you in advance.

lippmaje  
MqlDateTime mdt;
TimeCurrent(mdt);

if(Spread<MaxSpread && mdt.hour>=StartHour && mdt.hour<StopHour){
David Diez  
lippmaje:

It's working, thank you mate.

William Roeder  
David Diez: How to write this on MQ5?
if(Spread<MaxSpread&&Hour()>=StartHour&&Hour()<StopHour){

int     Hour(void         ){ return TimeHour(TimeCurrent()); }
int TimeHour(datetime when){ return when/3600 % 24; }
See also Migrating from MQL4 to MQL5 - MQL5 Articles № 11 17 May 2010
Reason: