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;
}
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use