Previous Next

GChartPatterns.GetFinish()

Returns a GStructChartPatterns object of a specified completed formation.

GStructChartPatterns  GChartPatterns.GetFinish(
   int              shift,     // Position of the past formation
   ENUM_TIMEFRAMES  timeFrame  // Timeframe of the desired formation
   );

Parameter

shift

[in]  Position of the formation within the time frame. 0 means the latest finished formation.

timeFrame

[in]  Timeframe of the formation.

Return value

In case of success, a GStructChartPatterns object is returned. If no past formation was detected at the position, the parameters in the returned object are all 0 (zero). In case of an error, a message is additionally output.


Beispiel:

//--- Connect the Glib class
#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)
{
   //--- Release memory when exiting
   delete chartPatterns;
}


void OnTick ()
{
   if ( chartPatterns.Ready() ) //--- Will be executed only when all data are ready
   {
      //--- Save the last formation and output the name:
      GStructChartPatterns tempFinishPattern = chartPatterns.GetFinish(0, PERIOD_D1);
      Print( tempFinishPattern.name );

      //--- Print the direction of the last complete formation:
      PrintEnumToString(chartPatterns.GetFinish(0, PERIOD_D1).targetDirection) );
   }
}


See also

GChartPatterns.Signal, GChartPatterns.GetAllFinish, GChartPatterns.GetBuild