Previous Next

GZigZag.GetAllPrices()

Fills a double array with the prices of the extreme points.

void  GZigZag.GetAllPrices(
   ENUM_TIMEFRAMES  timeFrame,           // Timeframe of the desired value
   double           &array[]             // Array for output of the data
   int              count = WHOLE_ARRAY  // Maximum number of data to be output
   );

Parameter

timeFrame

[in]  Time frame of the extremum

&array[]

[out]  The array to be filled with data.

count

[in]  Number of elements to be read.

Return value

In case of success, the passed array is filled with the elements and the array is shortened or enlarged to the number of elements. In case of error, the size of the array is 0 (zero) and a message is output.

Note

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


Beispiel:

//--- Include Glib classes
#include <Glib.mqh>

//--- Create a pointer to an empty class object
GZigZag *zigZag;


int OnInit ()
{
   //--- Assign the class to the empty class object
   zigZag = gZigZag();

   //--- Initialize the class data
   zigZag.Init();

   return(INIT_SUCCEEDED);
}

void OnDeinit (const int reason)
{
   //--- Release memory on exit
   delete zigZag;
}


void OnTick ()
{
   if ( zigZag.Ready() ) //--- Will be executed only when all data are ready
   {
      //--- Create array
      double array[];

      //--- Fill array
      zigZag.GetAllPrices(PERIOD_M5, array);

      //--- Check and output a value
      if (ArraySize(array)  >= 10)
      {
         Print(array[7]);
      }
   }
}


See also

GZigZag, GZigZag.Get, GZigZag.GetAll, GZigZag.GetAllLineLenghts, GZigZag.GetPrice