what wrong with my While Loop - page 3

 
Ovo:
According to the code he issued it was used in an indicator.

 

In that case, the sleep function doesn't work in an indicator, so it is stuck in a loop that probably repeats millions of times per second. This causes the platform to freeze. Probably the print gets stuck in a queue and as the loop is using 100% cpu, nothing happens.

There is nothing to gain with this code.

Hardly any resources are used by simply checking for a new bar at every new tick and returning if a new bar is not found. 

 
GumRai:

 

In that case, the sleep function doesn't work in an indicator, so it is stuck in a loop that probably repeats millions of times per second. This causes the platform to freeze. Probably the print gets stuck in a queue and as the loop is using 100% cpu, nothing happens.

There is nothing to gain with this code.

Hardly any resources are used by simply checking for a new bar at every new tick and returning if a new bar is not found. 

Yep, Sleep is of course the problem here, because it is inside an indicator :) But concerning the loop, it may be brutal without Sleep, but it is not infinite. It will use all the available core of the CPU, but given the presence of RefreshRates(), at some time it will report the new bar

 

best regards 

Reason: