indicator is too slow, rewrite the indicator, please

 
What is the actual reason of "indicator is too slow"? I noticed that adding an artificial delay (10-20 sec) in OnCalculate does not cause the appearance of that "too slow" message, therefore, the reason is not in the long calculation of an indicator.
 
aura: What is the actual reason of "indicator is too slow"? I noticed that adding an artificial delay (10-20 sec)
  1. The indicator is taking too long to complete. How the terminal detects it is probably network dependent.

  2. Indicators can not sleep, how could you add an artificial delay?

  3. Once it takes more than 2000 MS to complete OnCalculate you will start getting messages. 1500 MS was always fine with my testing. Reduce max bars on chart to something reasonable like 5K, have the indicator only calculate a limited number of bars, or process updates in groups, as I posted in
              How to do your lookbacks correctly #12.
 
To add a delay, I use the following code, but it does not cause an error. Therefore, the reason is not the execution time.
   uint tt=GetTickCount();
   while (GetTickCount()-tt<20000);

Some users getting an error, but I can't reproduce. Number of bars is already limited.

Reason: