EA start and stop hour + GMToffset

 

if I use +GMToffset in start/stop hours it will not work ... how can this be solved?

fex:

int extern FromHour = 8;
int extern ToHour = 14;
int extern GMToffset = 1;

if(Hour()>=FromHour+GMToffset && Hour()<=ToHour+GMToffset) return(0);
 
fulltilt:

if I use +GMToffset in start/stop hours it will not work ... how can this be solved?

fex:

Don't use Hour() instead use TimeHour( TimeCurrent() )
 

thank you, can I use it like bellow?

if(TimeCurrent()>=FromHour+GMToffset && TimeCurrent()<=ToHour+GMToffset) return(0);
 
fulltilt:

thank you, can I use it like bellow?


no 23+2 ??
 
RaptorUK:
Don't use Hour() instead use TimeHour( TimeCurrent() )


Why is this? I checked my indicators and I've done the same but I forgot why :)

@ fulltilt, I think Raptor means

if(TimeHour(TimeCurrent())>=FromHour+GMToffset && Hour()<=ToHour+GMToffset) return(0);

TimeCurrent() gets the server time of the last tick. And TimeHour() gets the hour figure from that.
 
alladir:


Why is this? I checked my indicators and I've done the same but I forgot why :)

@ fulltilt, I think Raptor means


TimeCurrent() gets the server time of the last tick. And TimeHour() gets the hour figure from that.


//TIMEZONECORRECTION   
int NewTime = (TimeCurrent()+ ((  0 - Timezone.from.Server) * 3600));
Try again
 

seems to be working ;-)

but what about the ToHour part in this case?

Hour()<=ToHour+GMToffset
if(TimeHour(TimeCurrent())>=FromHour+GMToffset && Hour()<=ToHour+GMToffset) return(0);
 
fulltilt:

seems to be working ;-)

but what about the ToHour part in this case?

RaptorUK:
Don't use Hour() instead use TimeHour( TimeCurrent() )

Where you have Hour() replace it with TimeHour( TimeCurrent() )
 
Convert server time to GMT time, then compare TimeHour
 
RaptorUK:
Where you have Hour() replace it with TimeHour( TimeCurrent() )



first part only, is this enough.?


if(TimeHour(TimeCurrent())>=FromHour+GMToffset && Hour()<=ToHour+GMToffset) return(0);
 
fulltilt:

first part only, is this enough.?



No, take your time reading this topic

read this twice if one time is not enough

and do it again if reading twice is not enough

... the answer why not is in this topic !!

Reason: