time working

 

hi guys

somebody know if it's possible to introduce a time working in each EA ?? for example.....if i want to work only beetwen 7:00 am and 5:00 pm ......

i have tried with some varables but it doesnt work .

can you help me please??

thanksssssssssssss

Giulio

 
giulioron:

hi guys

somebody know if it's possible to introduce a time working in each EA ?? for example.....if i want to work only beetwen 7:00 am and 5:00 pm ......

i have tried with some varables but it doesnt work .

can you help me please??

thanksssssssssssss

Giulio

Yes, it's possible.

For example:

if((Hour()<7)&&(Hour()>=17)) return;

else

{

// EA working here

}

 
robofx.org wrote >>

Yes, it's possible.

For example:

if((Hour()<7)&&(Hour()>=17)) return;

else

{

// EA working here

}

ok...i will try..... :-))))

i have noticed that some EA works very well only in specific hours.

thanksssss

 
i have tried but in this way i cant test my EA becasue the program read the time . i would trade only in some hours ( for example 8 am - 5 pm ) probably as you said me the program works correctly only in these hours but i cant test what can i do ??
 
giulioron wrote >>
i have tried but in this way i cant test my EA becasue the program read the time . i would trade only in some hours ( for example 8 am - 5 pm ) probably as you said me the program works correctly only in these hours but i cant test what can i do ??

Place int start() {

if (UseHourTrade){
if((Hour()>=FromHourTrade)&&(Hour()<=ToHourTrade))
Comment("Trading Hours");
else
{
Comment("Non-trading Hours");
return(0);
}
}

 
kiwi06 wrote >>

Place int start() {

if (UseHourTrade){
if((Hour()>=FromHourTrade)&&(Hour()<=ToHourTrade))
Comment("Trading Hours");
else
{
Comment("Non-trading Hours");
return(0);
}
}

this works on 24hr clock

extern string PARAMETERS_FILTER = "PARAMETERS FILTER";
extern bool UseHourTrade = false;
extern int FromHourTrade = 8;
extern int ToHourTrade = 18;

 
OK I try becasue in tester strategy it doesnt work. later i will inform you if it's ok. thanks again guys
 
it returns error ........ else unexpected token...... what's the meaning ?? probably it is easier to export in excel and analize ....
 
giulioron wrote >>
it returns error ........ else unexpected token...... what's the meaning ?? probably it is easier to export in excel and analize ....

I hope you did not include the word place if you did please remove it

 
no no...absolutaly not.... but returns error on else ....
 
giulioron wrote >>
no no...absolutaly not.... but returns error on else ....

Strange this is how i have this set up on my EA

//+------------------------------------------------------------------+
//| Start function                                                   |
//+------------------------------------------------------------------+
void start()  {
      if (UseHourTrade){
   if((Hour()>=FromHourTrade)&&(Hour()<=ToHourTrade))
      Comment("Trading Hours");
   else
     {
      Comment("Non-trading Hours");
      return(0);
     }
   }
Reason: