Previous Next

GChartPatterns.Signal()

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
   );

Parameter

&info

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

state

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

Notice

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


Beispiel:

//--- 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
   chartPatterns.Init();

   return(INIT_SUCCEEDED);
}

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( patternInfo.name +" on "+ EnumToString(patternInfo.timeFrame) );
      }
   }
}


See also

GChartPatterns.GetBuild