Run EA on Filtered Hours?

 

Hello,

I have coded EA to run on specified hours.

EA setting as 10.00 - 13.00, so it works for 10.00-13.00. but when i edit the settings as 10.30 - 13.30. which EA starts from 11 and ended with 13.30. what could be the problom?

{
    double datetime = TimeLocal();
    double hour0 = TimeHour(datetime);
    
    if ((HoursFrom < HoursTo && hour0 >= HoursFrom && hour0 < HoursTo) ||
    (HoursFrom > HoursTo && (hour0 < HoursTo || hour0 >= HoursFrom)))
    {
        Arrow();
        
    }
    
} 
 
sheriffonline :

Hello,

I have coded EA to run on specified hours.

EA setting as 10.00 - 13.00, so it works for 10.00-13.00. but when i edit the settings as 10.30 - 13.30. which EA starts from 11 and ended with 13.30. what could be the problom?

So you are comparing a int (TimeHour) with a double ( HoursFrom and HoursTo ) and you are comparing your Local Timezone with ServerTime . . . and you wonder why you are having issues ?
 
RaptorUK :
So you are comparing a int (TimeHour) with a double ( HoursFrom and HoursTo ) and you are comparing your Local Timezone with ServerTime . . . and you wonder why you are having issues ?

yes. you said correct.
 

Can anyone support me?

I want to run EA on filtered hours and minutes.

eg: EA should run at 10.30AM to 18.30PM. what is the easiest way to code?

 
sheriffonline:

Can anyone support me?

I want to run EA on filtered hours and minutes.

eg: EA should run at 10.30AM to 18.30PM. what is the easiest way to code?

You know what is wrong, fix your code . . .
 
sheriffonline:

Can anyone support me?

I want to run EA on filtered hours and minutes.

eg: EA should run at 10.30AM to 18.30PM. what is the easiest way to code?

extern int t1 = 1030; // 10:30 time server
extern int t2 = 1830; // 18:30 time server


int start();
{
  
  int d = 100 * Hour() + Minute();

  if ( d < t1 || d > t2 )
  {
   return;
  }

  // your ea code


return;
} 
 
Boeing747:
almost possible also t1>t2
extern int t1 = 1030; // 10:30 time server
extern int t2 = 1830; // 18:30 time server


int start();
{
  
  int d = 100 * Hour() + Minute();

  if ((( d < t1 || d > t2 )&& t1 < t2)||(( d < t2 && d > t1 )&& t1 > t2))
  {
   return;
  }

  // your ea code


return;
} 
 
RaptorUK:
You know what is wrong, fix your code . . .


Found my mistake. now fixed. Thanks for the support.
Reason: