Trading Time problems in EA

 

Hi,


I want to trade between 4:30 and 6:00


It seems that i can specify a logical command for hours, with (Hours()>=4 && Hours()<=6), but specifying the minutes causes logical errors.


Any suggestions for trading this way?

 
   datetime start = StrToTime("04:30");
   datetime end = StrToTime("06:00");
   
   if(TimeCurrent() >= start && TimeCurrent() < end){
      Print("TRADING");
   }else{
      Print("NOT TRADING");
   }
   
   Comment(
      StringConcatenate(
         "Start: ", TimeToStr(start, TIME_MINUTES), "  ", TimeToStr(start, TIME_DATE), "\n",
         "End: ", TimeToStr(end, TIME_MINUTES), "  ", TimeToStr(end, TIME_DATE), "\n"
      )
   );
 

nice to see someone using StringConcatenate()... the docs state is mucho faster than concatenate operator '+' yet is rare to see the builtin called ;)

 

Thnx! a lot.

its very Help full to me.

jmca:

Reason: