Previous Next

GZigZag.GetPrice()

Returns the price of the extremum of a specific shift.

double  GZigZag.GetPrice(
   ENUM_TIMEFRAMES  timeFrame,   // Timeframe of the desired value
   int              ZigZagShift  // Shift of the desired extreme point. Not of the individual bar.
   );

Parameter

timeFrame

[in]  Timeframe of the extremum

ZigZagShift

[in]  Shift of the extremum. Not the bar. 0 means the current, unfinished extremum. 1 corresponds to the last fixed extremum.

Return value

In case of success, the price is returned as double. In case of error, 0 (zero) is returned and an error message is displayed.


Beispiel:

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

//--- Erzeugung eines Zeigers zu einem leeren Klassenobjektes
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
   {
      //--- Output the price of the last fixed extreme point directly:
      Print( zigZag.GetPrice(PERIOD_D1, 1) );
   }
}


See also

GZigZag, GZigZag.Get, GZigZag.GetAll, GZigZag.GetAllLineLenghts, GZigZag.GetAllPrices