How to remove dynamic objects from indicator

 

Hello,

my indicator has some new xobject.

When the indicator is detached, i get memory leaks as there is no onDeinit method.

How to catch the detach event ? 

Thank you 

 
chinaski:

Hello,

my indicator has some new xobject.

When the indicator is detached, i get memory leaks as there is no onDeinit method.

How to catch the detach event ? 

Thank you 

Why? There should be an OnDeinit() call on indicator detachment.
 
chinaski:

Hello,

my indicator has some new xobject.

When the indicator is detached, i get memory leaks as there is no onDeinit method.

How to catch the detach event ? 

Thank you 

You should add OnDeinit manually by hand, I don't know why its not there anymore when creating CI.

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//--- indicator deinitialization
   
//---
   return;
  }

Then create some codes to delete your object

 
phi.nuts:

You should add OnDeinit manually by hand, I don't know why its not there anymore when creating CI.

Then create some codes to delete your object

You should report this as a bug to Service Desk.
Get in touch with developers using Service Desk!
Get in touch with developers using Service Desk!
  • www.mql5.com
We therefore attach great importance to all user reports about issues in our programs and try to answer each one of them.
 

Hello,

thank you for answers,

void OnDeinit(const int reason)

 is called on chart detach, so it solved my problem.

Reason: