Sleep Alternative!!

 

Hey !

I know that sleep command does not work in strategy tester.So i searched and try some ideas described by users,but none work for me.I want to make EA sleep if condition is true but when i try its alternatives at someconditions it does not sleep and some time it does not processed further. I cannot under stand what actually the problem is .Hope so that someone can help me to know the problem.

Here is one of  alternatives i try

 int _time_waiting=0;
 int _PauseTime=TimeCurrent();

Void OnTick()
{ 
  if( //condition true )          // if first condition true move further                                      
 _time_waiting = _PauseTime + 10;  // wait for 10 sec
  // Do stuff                      // 
  if ( TimeCurrent() >= _time_waiting )    // wait until 10 seconds have passed
   {
    // Do Stuff                         // the block to be processed after sleep command 
   }

}  


 

I always use this kind of wait/sleep:

void OnTick() {
   datetime waitsec = 100;
   static datetime nextAction=0;
   if (TimeCurrent()<nextAction) return;
   ...
   nextAction = TimeCurrent()+waitsec;
   ...
}
 
ceaser234: I cannot under stand what actually the problem is .
Until you return to the tester, to get the next tick, nothing changes.
Reason: