Download MetaTrader 5

How to remove dynamic objects from indicator

To add comments, please log in or register
Searching on MQL5.community is performed in all sections. Try it!
chinaski
890
chinaski 2013.03.10 04:35 

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 

Andrei Moraru
1157
Andrei Moraru 2013.03.10 09:31  
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.
phi nuts
2184
phi nuts 2013.03.10 10:51  
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

Alain Verleyen
Moderator
30724
Alain Verleyen 2013.03.10 11:43  
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.
chinaski
890
chinaski 2013.03.11 13:47  

Hello,

thank you for answers,

void OnDeinit(const int reason)

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

To add comments, please log in or register