Previous Next

GChartPatterns.Deinit()

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

The function .Deinit() supports the destructor of MQL5 in order to disassemble the class error-free.

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

The best use of this function is to perform 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 deinitStep = 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 gently and then call the official destructor of the MQL5 language to release the reserved memory allocations.


See also

GChartPatterns, GChartPatterns.ClearPaint