Previous Next


Finds out if a candle is pokes into a value.

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

bool  GBar.PeakDownInto(
   int              shift,                     // Shift
   double           value,                     // Price
   ENUM_TIMEFRAMES  timeFrame = PERIOD_CURRENT // Timeframe



[in]  The offset of the bar to be checked. 0 (zero) is the current, unfinished bar.


[in]  The price to be checked for a peak.


[in]  The timeframe of the candle.

Return Value

Returns true if the desired candle pokes the target value.


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

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

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

   //--- Initialize class data

   //--- Initialize pivot points


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

void OnTick ()
   if ( supportAndResistance.Ready() ) //--- Only executed when all data is ready
      //--- Draw values on chart

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

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

      //--- Checking completeness
      if (ArraySize(array) >= 7)
         //--- Check if last candle pierces down into Daily-Pivot S1
         Print( bar.PeakDownInto(1, array[PIVOT_S1]) );

See also