A simpler way to get Hour() value

 

How to write this on MQ5?

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

Thank you in advance.

 
MqlDateTime mdt;
TimeCurrent(mdt);

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

It's working, thank you mate.

 
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
 

@William Roeder

Thank you for the Article link. It has been so useful to me.