TimeHour() doesnt work in EA tester?

 

I'm fairly new to EA coding but i am completely stumpped here....

I have no errors in my code, no syntax errors, nothing. EA works as it should perfectly when i attach to a demo account forward testing. But it does nothing in the strategy tester!


I have tried other EAs (not built by me) in the strategy tester with the same settings, dates, etc and all of them work fine. I dont know why mine does nothing, even alerts dont show up.

The journal shows no errors at all.

I am thinking it might have something to do with how i open trades in the EA because its based on time. for example i have something like:

hour=TimeHour(Time[0])

if(hour+GMT_offset==13)
{
do something.....
}

could this cause problems in the strategy tester? i dont know... but i have tried another EA that uses a timed based entry similar to mine and that one runs perfect in the strategy tester....im lost. I was thinking maybe the strategy tester is pulling the time from the current live server instead of the 'simulated' time in the strategy tester. But i doubt thats the issue....

 I have also just quickly made another EA almost identical to the other one but i removed the time based part and it worked in the strategy tester.... whats going on here???

 
I would at first start the tester in visual mode with the EA and the used indiactors to look for patterns where the EA - as I think - should buy or sell and there I check all the values... Time, prices, indicators,...
 
gooly:
I would at first start the tester in visual mode with the EA and the used indiactors to look for patterns where the EA - as I think - should buy or sell and there I check all the values... Time, prices, indicators,...

Hi, i do run in visual mode but i do not use any indicators with this EA, its literally buy/sell at this hour. Thats the only thing i am trying to do. and it does not work. Even if all i put in the code:

 

hour=TimeHour(Time[0]);

if(hour==13){

Alert("IT DOESNT F**KING WORK");

}

 

 nothing happens......  its like the strategy tester cant work with "TimeHour(Time[0])" is my theory.

 EDIT: nevermind, figured it out! i was putting the "hour=TimeHour(Time[0])" outside of start() as a global variable! so it only got set once! that part of the code is now inside start() and everything works in strategy tester now. 

 

I suggest that you only allow once per hour==13

 If you are expecting a pop-up, that won't happen in the tester but you will get the alert printed in the journal

   static bool check=true;

   int hour=TimeHour(Time[0]);
   if(hour!=13)
      check=true;
   if(hour==13 && check)
      {
      Alert("IT DOES WORK");
      check=false;
      }
 
GumRai:

I suggest that you only allow once per hour==13

 If you are expecting a pop-up, that won't happen in the tester but you will get the alert printed in the journal

Hi GumRai,

 yep i was made aware of this when i was testing it out live xD constant ALERTS! and in the full code i do have a check flag. Thanks for caring though :) 

 I have figured out my problem now anyway, but thanks for the interest.