Download MetaTrader 5

Indicator to remove itself

To add comments, please log in or register
Matej
67
Matej  

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.

qjol
3243
qjol  

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

Denny Muhammad Zein
1558
Denny Muhammad Zein  
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

To add comments, please log in or register