how to have the text removed after removing the indicator

 

Hi,

I have some indicators which display text on the screen using the ObjectCreate function


after I remove the indicator, the text is still visible. 

What I thought was needed was ObjectDelete in the deinit function but that doesn't seem to do the trick.


in another indicator I have I don't even have the Objectdelete and I have no problem with the text being removed.

thanks

 
Jens89 :

Hi,

I have some indicators which display text on the screen using the ObjectCreate function


after I remove the indicator, the text is still visible. 

What I thought was needed was ObjectDelete in the deinit function but that doesn't seem to do the trick.


in another indicator I have I don't even have the Objectdelete and I have no problem with the text being removed.

thanks


If your indicator has created a graphic object, then your indicator should be removed afterward - your indicator should remove the graphic object.

Example:

The indicator Size of candles (text) creates OBJ_TEXT objects and deletes them in OnDeinit.

 
Vladimir Karputov:


If your indicator has created a graphic object, then your indicator should be removed afterward - your indicator should remove the graphic object.

Example:

The indicator Size of candles (text) creates OBJ_TEXT objects and deletes them in OnDeinit.


thanks for your quick reply


so should:


int OnDeinit()

{

ObjectDelete("whatever the name of the indicator is called");


}


always delete whatever you created?


just curious why it has to be OnDeinit and not deinit?


quite new to MQL4 so not sure yet. 


thanks

 
Jens89 :



Please go to the link I gave - you will see that my code is MQL5.
Reason: