Download MetaTrader 5

Why not sleeping?

To add comments, please log in or register
Find out how to add a video in the messages editor
ttechnik
256
ttechnik 2011.02.13 22:47 


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
14504
whroeder1 2011.02.15 01:35  
You can't sleep in indicators and you can't sleep in the tester.
ttechnik
256
ttechnik 2013.10.09 21:45  
WHRoeder:
You can't sleep in indicators and you can't sleep in the tester.

THX
ttechnik
256
ttechnik 2014.02.02 20:03  
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