Previous Next


Returns true as soon as a formation has reached a GEnumChartPatternsStates status and then fills a GStructChartPatterns object with the values of the formation.

bool  GChartPatterns.Signal(
   GStructChartPatterns      &info,               // Object for the information to the signal
   GEnumChartPatternsStates  state = CP_BREAKOUT  // Formations status for the output of a signal



[out]  The GStructChartPatterns object into which the information about the signal is to be written.


[in]  The GEnumChartPatternsStates status that should be reached to generate a signal.

Return value

In case of success, the passed object is filled with the information of the signal and the function returns true.


Each signal, to each formation, is output only once at the time of the signal.


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

//--- Creating 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


void OnDeinit (const int reason)
   //--- Free memory on termination
   delete chartPatterns;

void OnTick ()
   if ( chartPatterns.Ready() ) //--- Runs only when all data is ready
      //--- Create array structure
      GStructChartPatterns patternInfo;

      //--- Waits for a signal and then outputs the name of the formation and the time frame
      if (chartPatterns.Signal(patternInfo))
         Print( +" on "+ EnumToString(patternInfo.timeFrame) );

See also