Previous Next

GBar.PeakDownInto()

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
);

Parameter

shift

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

value

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

timeFrame

[in]  The timeframe of the candle.

Return Value

Returns true if the desired candle pokes the target value.


Example:

//--- 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
   supportAndResistance.Init();

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


   return(INIT_SUCCEEDED);
}

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
      supportAndResistance.Paint();

      //--- 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

GBar.PeakUpInto