Previous Next

GBar.Open()

Returns the open price of a candle.

double  GBar.Open(
   int              shift,                     // Shift
   ENUM_TIMEFRAMES  timeFrame = PERIOD_CURRENT // Timeframe of the value
);

Parameter

shift

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

timeFrame

[in]  The timeframe of the candle.

Return value

Returns the open price of a candle.


Example:

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

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


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

   return(INIT_SUCCEEDED);
}

void OnDeinit (const int reason)
{
   //--- If ending memory free
   delete bar;
}


void OnTick ()
{
   //--- Output the opening price of the last bar
   Print( bar.Open(1) );
}


See also

GBar.High, GBar.Low, GBar.Close