MQL4参考 普通函数 Sleep


The function suspends execution of the current Expert Advisor or script within a specified interval.

void  Sleep(
   int  milliseconds      // interval



[in]  Delay interval in milliseconds.

Return Value

No return value.


The Sleep() function can't be called for custom indicators, because indicators are executed in the interface thread and must not slow down it. The function has the built-in check of EA halt flag every 0.1 seconds.

Sleep() function does not suspend execution of the Expert Advisor in the Strategy Tester.