Previous Next

GChartPatterns.GetAllFinish()

Fills a GStructChartPatterns object array with the values of the finished formations.

void  GChartPatterns.GetAllFinish(
   ENUM_TIMEFRAMES       timeFrame,           // Timeframe of the desired values
   GStructChartPatterns  &array[]             // Array for the output of the data
   int                   count = WHOLE_ARRAY  // Maximum number of data to be output
   );

Parameter

timeFrame

[in]  Timeframe of the detected formations.

&array[]

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

count

[in]  Number of elements to be read out at most.

Return value

In case of success, the array specified is filled with the elements and the array is reduced to the number of elements. In case of error, the size of the array is 0 (zero) and a message is displayed.

Note

The array should always be checked for content after filling. Due to incomplete historical data passed from the terminal to Glib, there may be occasional errors in the output.


Example:

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

//--- Creation of 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 on close
   delete chartPatterns;
}


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

      //--- Allocate memory
      ArrayResize(array, 256);

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

      //--- Check and output the last solid value
      if (ArraySize(array) >= 1)
      {
         Print(array[1].name);
      }
   }
}


See also

GChartPatterns.GetFinish, GChartPatterns.Signal, GChartPatterns.GetBuild