Previous Next

GSupportAndResistance.Deinit()

Because of the amount of data that Glib has to calculate, we have focused on a processor-friendly development.

The function .Deinit() supports the destructor of MQL5 to tear down the class without errors.

In addition, the .Deinit() function removes all objects of the class from the chart.

The best use of this function is to execute it exclusively in its own tick before you initiate further deinitialization measures.

An example of a complete and optimal use can also be found in the file "Glib_FullTrading_Sample.mq5".

Example:

int initStep = 0;

void OnTick ()
{
   if ( deinitStep != 0 ) //--- Deinitialization can be started by changing the variable deinitStep to 1
   {
      if(deinitStep == 1) supportAndResistance.Deinit();
      if(deinitStep == 2) cartPatterns.Deinit();
      if(deinitStep == 3) zigZag.Deinit();
      if(deinitStep == 4) ExpertRemove();

      deinitStep++;
   }
}

In this way, the classes can remove the data in a gentle way and therefore call the official destructor of the MQL5 language to release the reserved memory allocations.


See also

GSupportAndResistance, GSupportAndResistance.ClearPaint