Download MetaTrader 5

Why not sleeping?

To add comments, please log in or register
ttechnik
258
ttechnik  


Hi,

I probe this code.

.........while(j<10 && (iClose(CurrentSymbol,ServerSyncTimeFrame,2)==0 || GetLastError()==4066)) // call the iClose() function with a shift of 2 to ensure we sample the timeseries in a likely unsynchronized span
{
j++; // increment the while loop counter
if(verbose==true) Print("Sync cycle ",j,": Sleeping for ",sleep_seconds," seconds to let the server synchronize with requested date for Period M",ServerSyncTimeFrame);
Sleep(sleep_seconds*1000); // sleep to give the server time to update the local hst file
}
if(j==10)
{
Print("Failed to synchronize the hst data with the server after ",j," cycles and ",j*sleep_seconds," seconds");
return(0);
}
}.................


But I don't use it.

The Sleep(sleep_seconds*1000); function is not runing. Not sleep!


Why?


In the documentation: "The Sleep() function cannot be called from custom indicators since they calculate in the interface thread and may not decelerate it."

What is it?

whroeder1
16080
whroeder1  
You can't sleep in indicators and you can't sleep in the tester.
ttechnik
258
ttechnik  
WHRoeder:
You can't sleep in indicators and you can't sleep in the tester.

THX
ttechnik
258
ttechnik  
WHRoeder:
You can't sleep in indicators and you can't sleep in the tester.

https://www.mql5.com/en/forum/127105
To add comments, please log in or register