Previous Next

GSupportAndResistance.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.

So errors can be prevented when starting an expert based on the data of Glib.

bool  GSupportAndResistance.Ready();

Return value

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


Example:

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

//--- Creating a pointer to an empty class object
GSupportAndResistance *supportAndResistance;


int OnInit ()
{
   //--- Assign the class to the empty class object
   supportAndResistance = gSupportAndResistance();

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

   //--- Set the line length
   supportAndResistance.SetMarkersLengthRight(3.5); // set the length of the markers on the right side

   return(INIT_SUCCEEDED);
}

void OnDeinit (const int reason)
{
   //--- Free up memory on exit
   delete supportAndResistance;
}


void OnTick ()
{
   if ( supportAndResistance.Ready() ) //--- Only executed when all data is ready
   {
      //--- Draw data set on the chart
      supportAndResistance.Paint();
   }
}


See also

GSupportAndResistance