wait (int n): int
Suspends execution for the time given by n in milliseconds. The user
interface remains responsive during the wait time. The function returns 0 when the [Stop] button was hit
or quit was called, otherwise nonzero.
If n is negative, the function checks and updates the user interface only every nth time, for not
delaying fast loops. Use wait in a loop for avoiding unresponsiveness during long computations or external function calls.
For displaying progress during very long processes, use
n - wait time in milliseconds when positive, user interface
update frequency when negative, 0 for immediate user interface
0 when the script is to be terminated, 1 otherwise.
- Trades and prices are not updated during wait time, so do not use
this function to wait for a trade
to enter or a price limit to be reached. For triggering a function at a
certain event, use call.
- Since wait() triggers the Windows message system, even
wait(0) can take several hundred microseconds on slow
systems. Use wait(-1000) in time critical loops.
Rx("TrainNeuralNet()",1); // start a long computation
while(Rrun() == 2)
if(!wait(100)) return; // wait until computation is finished or [Stop] was hit
if(!wait(-1000)) break; // prevent unresponsiveness in long loops
timer, run, R bridge, lock,
BUSY, quit, version, progress,