Previous Next


Fills a double array with the prices of the pivot points of the selected time unit.

void  GSupportAndResistance.GetPivots(
   double           &array[],  // Array to output the data
   ENUM_TIMEFRAMES  timeFrame  // Timeframe of the values



[out]  The array to be filled with data.


[in]  Time frame of desired prices. -1 Outputs the data of all active timeframes.

Return value

In case of success, the passed array is extended and supplemented by the pivot elements. In case of error, the pivot points are not added and a message is output.


Even if it is possible to append to other arrays, it is recommended to store the pivot points in a separate array in order to access them via the enumerations ENUM_PIVOTS.


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

//--- Creation of a pointer to an empty class object
GSupportAndResistance *supportAndResistance;

int OnInit ()
   //--- Assign the class to the empty class object
   supportAndResistance = gSupportAndResistance();

   //--- Initialize the class data

   //--- Initialize the pivot points


void OnDeinit (const int reason)
   //--- Free memory on closing
   delete supportAndResistance;

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

      //--- Fill the array
      supportAndResistance.GetPivots(array, PERIOD_D1);

      //--- Check and output the values
      if  (ArraySize(array) >= 7)
         Print( array[PIVOT_R1] );

See also

GSupportAndResistance.InitPivots, GSupportAndResistance.GetAll, GSupportAndResistance.GetAllPrices