Previous Next

GChartPatterns.ChartEvent()

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

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

void  GChartPatterns.ChartEvent(
   const int     id,       // id for further processing
   const long    &lparam,  // long parameter for further processing
   const double  &dparam,  // double parameter for further processing
   const string  &sparam   // string parameter for further processing
   );

Parameters

id

[in]  id parameter for the transmission to the Glib ChartEvent. Here simply enter the variables of OnChartEvent.

lparam

[in]  long parameter for the transmission to the Glib ChartEvent. Here simply enter the variables of OnChartEvent.

dparam

[in]  double parameter for the transmission to the Glib ChartEvent. Here simply enter the variables of OnChartEvent.

sparam

[in]  string parameter for the transmission to the Glib ChartEvent. Here simply enter the variables of OnChartEvent.

Note

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


Example:

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

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


int OnInit ()
{
   //--- The class assign the empty class object
   chartPatterns = gChartPatterns();

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

   return(INIT_SUCCEEDED);
}

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

void OnTick ()
{
   if ( chartPatterns.Ready() ) //--- It is only executed when all data are ready
   {
      //--- Display data on the chart
      chartPatterns.JustPaint();
   }
}


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


See also

GChartPatterns