Indicator to remove itself

 

I was wondering if it's possible for an indicator to remove itself.

Currently I use an indicator to create a label on the chart and update it every tick. But if you want to remove it, you have to first remove the indicator, and also remove the label. I know that in the deinit() function I can put code that will delete the label, but, would it be possible that if the indicator detects that the label no longer exists (user has deleted it), it deinitializes itself?


Thank you.

 

as far as i know Computers can not do anything without telling them how to do & Can do anything if you tell them how to do

 
Papler:

I was wondering if it's possible for an indicator to remove itself.

Currently I use an indicator to create a label on the chart and update it every tick. But if you want to remove it, you have to first remove the indicator, and also remove the label. I know that in the deinit() function I can put code that will delete the label, but, would it be possible that if the indicator detects that the label no longer exists (user has deleted it), it deinitializes itself?


Thank you.


 Have a look at 

https://docs.mql4.com/objects/ObjectFind

and

https://docs.mql4.com/chart_operations/chartindicatordelete

Reason: