Previous Next

GSupportAndResistance.ChartEvent()

Contains the functions for triggering ChartEvents in relation to Glib functions.

It is recommended to integrate this function in every expert, in every Glib class.

void  GSupportAndResistance.ChartEvent(
   const int     id,       // id to be passed on
   const long    &lparam,  // long parameter to be passed on
   const double  &dparam,  // double parameter to be passed on
   const string  &sparam   // string parameter to be passed on
   );

Parameter

id

[in]  id for passing to the Glib ChartEvent. Just enter the variables from OnChartEvent.

lparam

[in]  long for passing to the Glib ChartEvent. Here simply enter the variables from OnChartEvent.

dparam

[in]  double for passing to the Glib ChartEvent. Here simply enter the variables from OnChartEvent.

sparam

[in]  string for passing to the Glib ChartEvent. Just enter the variables from OnChartEvent here.

Note

This function should be used anytime when using the class, as it provides, among other things, deinitialization of the class by button automatically.


Example:

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

//--- Creation of 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();

   return(INIT_SUCCEEDED);
}

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

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


void OnChartEvent (const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
{
      //--- Use ChartEvents including automatic class destructor
      supportAndResistance.ChartEvent(id, lparam, dparam, sparam);
}


See also

SupportAndResistance