Previous Next


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



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


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


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


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

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

See also

GChartPatterns.Signal, GChartPatterns.GetAllFinish, GChartPatterns.GetBuild