Previous Next

GChartPatterns.GetBuild()

Fills a GStructChartPatterns object array with information about all current formations in formation of a certain time unit.

void  GChartPatterns.GetBuild(
   ENUM_TIMEFRAMES       timeFrame,           // Timeframe of the requested values
   GStructChartPatterns  &array[]             // Array for output of the data
   int                   minimumCompleteness = 1  // The minimum completeness of the formation
   );

timeFrame

[in]  Timeframe of the detected formations.

&array[]

[out]  The array that should be filled with the data. Due to a bug of the MT5 terminal, enough memory must be reserved with ArrayResize() before the array is passed to the function.

Count

[in]  The minimum completeness of the formation before it is included in the array.

Return value

In case of success, the passed array is filled with the elements and the array is shortened to the number of elements.

Note

The array should always be checked for content after filling. If there are no formations in Enstehung, the size of the array is 0.


Example:

//--- Insert 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 exit
   delete chartPatterns;
}


void OnTick ()
{
   if ( chartPatterns.Ready() ) //--- will only be executed when all data is ready
   {
      //--- Create structure array
      GStructChartPatterns array[];

      //--- Allocate memory
      ArrayResize(array, ArraySize(GChartPatternsNames));

      //--- Fill the array
      chartPatterns.GetBuild(PERIOD_H1, array);

      //--- Checking and output of the name of the current formation
      if (ArraySize(array) >= 1)
      {
         Print(array[0].name);
      }
   }
}


See also

GChartPatterns.GetBuild, GChartPatterns.Signal, GChartPatterns.GetFinish, GChartPatterns.GetAllFinish