Object doesn't delete

To add comments, please log in or register
Seyedmasoud Hashemi
381
Seyedmasoud Hashemi  

hi every one

i have a custom indicator that create some object graphic 

but after i delete the indicator they are still there( one button ans some label)

i use this code in my indicator:

void OnDeinit(const int reason)
  {

   for(int i=ObjectsTotal(0,-1,-1); i>=0; i--)
     {
      ObjectDelete(0,ObjectName(i));
     }
   |

can anyone help me??

Lorentzos Roussos
22576
Lorentzos Roussos  
Seyedmasoud Hashemi:

hi every one

i have a custom indicator that create some object graphic 

but after i delete the indicator they are still there( one button ans some label)

i use this code in my indicator:

can anyone help me??

Instate a prefix for all your indicator objects in a global string 

string SystemPrefix="MYOBJECTS_";
int OnInit()

then every object you create add this before the object name 

SystemPrefix+"..." ;//the name you had given in ...

then on deinit

void OnDeinit(const int reason)
  {
  ObjectsDeleteAll(ChartID(),SystemPrefix);
  }

note you can use prefixes for different parts of your system like screens ,popup elements etc

To add comments, please log in or register