Previous Next

GBar.PeakUpInto()

Determines whether a candle is pokes a value.

If the body of the candle is below the desired value and only the highest point is above the value, the poke is considered true.

bool  GBar.PeakUpInto(
   int              shift,                     // Shift
   double           value,                     // Target price
   ENUM_TIMEFRAMES  timeFrame = PERIOD_CURRENT // Timeframe of the value
);

Parameter

shift

[in]  Bar index of the candle.

value

[in]  The price value to be checked for poke.

timeFrame

[in]  The timeframe of the candle.

Return value

Returns true if the desired candle pokes the target value.


Example:

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

//--- Create a pointer to an empty object
GBar *bar;
GSupportAndResistance *supportAndResistance;


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

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

   //--- Initialize the pivot points
   supportAndResistance.InitPivots();


   return(INIT_SUCCEEDED);
}

void OnDeinit (const int reason)
{
   //--- Free memory on exit
   delete bar;
   delete supportAndResistance;
}


void OnTick ()
{
   if ( supportAndResistance.Ready() ) //--- Perform this code only if all data is ready
   {
      //--- Draw values on chart
      supportAndResistance.Paint();

      //--- create double array
      double array[];

      //--- fill array
      supportAndResistance.GetPivots(array, PERIOD_D1);

      //--- check for completeness
      if (ArraySize(array) >= 7)
      {
         //--- Checks if last candle pokes up into Daily-Pivot R1
         Print( bar.PeakUpInto(1, array[PIVOT_R1]) );
      }
   }
}


See also

GBar.PeakDownInto