Previous Next

GChartPatterns.Ready()

Checks if the data of the class is ready for use.

After a class has been created and initialized, it needs a few ticks to collect all the data. This function checks if the data is ready for use.

This can prevent errors when starting an expert based on the data from Glib.

bool  GChartPatterns.Ready();

Return value

In case of success, true is returned and a message is output that the class data is ready.


Beispiel:

//--- Including Glib classes
#include <Glib.mqh>

//--- Creation of a pointer to an empty class object
GChartPatterns *chartPatterns;


int OnInit ()
{
   //--- Assign the class to the empty class object
   chartPatterns = gChartPatterns();

   //--- Initialize the class data
   chartPatterns.Init();

   return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason)
{
   //--- Free memory
   delete chartPatterns;
}


void OnTick ()
{
   if ( chartPatterns.Ready() ) //--- Will only be executed when all data are ready
   {
      //--- Draw the chart
      chartPatterns.JustPaint();
   }
}


See also

GChartPatterns.Init