How can I let EA run from 23:00 to 09:00 (GMT time)?

 
void OnTick()  {


//call the function

if(TimeAllow(23,9)>0) {
   //your code here...

}


}


int TimeAllow(int s, int e) {

   int start_time, end_time;
   int gmt_hour=TimeHour(TimeGMT());
   if(s>e) {
      if(gmt_hour>=s) {
         start_time=s;
         end_time=24+e;
      } else {
         start_time=0;
         end_time=e;
      }
   } else { start_time=s; end_time=e; }
   if(gmt_hour>=start_time && gmt_hour<=end_time) return(1);
return(0);
}


 
Abdul Rahman:
void OnTick()  {


//call the function

if(TimeAllow(23,9)>0) {
   //your code here...

}


}


int TimeAllow(int s, int e) {

   int start_time, end_time;
   int gmt_hour=TimeHour(TimeGMT());
   if(s>e) {
      if(gmt_hour>=s) {
         start_time=s;
         end_time=24+e;
      } else {
         start_time=0;
         end_time=e;
      }
   } else { start_time=s; end_time=e; }
   if(gmt_hour>=start_time && gmt_hour<=end_time) return(1);
return(0);
}


many thanks
 

I use something like this ...

It works fine ... 

input bool         UseTimeFilter = true;                //**Use Time Filter For Trading Hours
input int              StartHour = 18;                  //**Starting Hour 
input int                EndHour = 6;                   //**Ending Hour

bool EAActivated;

...
...
...

int start(){

   if((Hour()>=StartHour && Hour()<EndHour && StartHour<EndHour) || ((Hour()>=StartHour || Hour()<EndHour) && StartHour>EndHour))
      EAActivated=true; 
   else
       EAActivated=false; 

   if(EAActivated && ... && ... && ...)
      OpenBuy();

   if(EAActivated && ... && ... && ...)
      OpenSell();

   ...
   ...
   ...
}