Previous Next

GBar.MiddleHighLow()

Returns the midpoint between the highest and lowest point of a candle.

double  GBar.MiddleHighLow(
   int              shift,                     // offset
   ENUM_TIMEFRAMES  timeFrame = PERIOD_CURRENT // time frame of the value
);

Parameter

shift

[in]  The candle shift. 0 (zero) is the current unclosed candle.

timeFrame

[in]  The timeframe of the candle.

Return value

Returns the center between the highest and lowest point of a candle.


Example:

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

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


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

   return(INIT_SUCCEEDED);
}

void OnDeinit (const int reason)
{
   //--- Free memory when closing
   delete bar;
}


void OnTick ()
{
   //--- Print the middle point between High/Low of the last candle
   Print( bar.Open(1) );
}


See also

GBar.MiddleOpenClose