Problem with sleep() function

 
 

Sleep doesn't seem to work

Hi

I am also having problems with sleep (lol).

I find it doesn't work - definetly not when using stratergy tester to test an ea, so I set a variable to the time I want my expert to sleep and then check that variable

if (CurTime()< time1)

{

return(0);

}

else

{

Sell1();

Print("SELL order opened : ",OrderOpenPrice());

time1 = CurTime()+2*60*Period();

}

 

that doesn't even work

But I am finding even that does not work

Weird

 

working

Found that you can't initilize time in the init() section

So go like this

static double time1=0;

...

void init()

{

return(0)

}

int start()

{

if (CurTime()<= time1)

{

//Print(" Cur: ",TimeToStr(CurTime(),TIME_DATE|TIME_SECONDS)," time1: ",TimeToStr(time1,TIME_DATE|TIME_SECONDS));

return(0);

}

SellOrdOpen();

time1 = CurTime()+360;

}