Ending a EA which is in a loop.

 

I want to know how to end the EA which is running in a never ending loop.  can anybody help.  Cheers  

Is there a exit function i could use. what is the syntax ?

 
kumarkar108:

I want to know how to end the EA which is running in a never ending loop.  can anybody help.  Cheers  

Is there a exit function i could use. what is the syntax ?

Depends on the code - you could use break;  ExpertRemove(); return; or instead change the loop control mechanism, depending on the situation.

If you share the code it would be easier to see what the right approach could be

 

If the infinite loop is something needed in the logic, then I would use isStopped() to avoid abnormal terminations

while(!IsStopped()) { /* */ }

However that's not something I would recommend doing in an EA or indicator (you can use timers for that purpose), but in scripts and services it can make more sense depending on the case

 
R4tna C #:

Depends on the code - you could use break;  ExpertRemove(); return; or instead change the loop control mechanism, depending on the situation.

If you share the code it would be easier to see what the right approach could be

thank you

 
Manuel Alejandro Cercos Perez #:

If the infinite loop is something needed in the logic, then I would use isStopped() to avoid abnormal terminations

However that's not something I would recommend doing in an EA or indicator (you can use timers for that purpose), but in scripts and services it can make more sense depending on the case

thank you