Previous Next

GBar.IsBull()

Checks if a candle is bullish.

bool  GBar.IsBull(
   int              shift,                     // Shift
   ENUM_TIMEFRAMES  timeFrame = PERIOD_CURRENT // Time frame of the value
);

Parameter

shift

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

timeFrame

[in]  The timeframe of the candle.

Return Value

Returns true if the selected candle is bullish.


Example:

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

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


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

   return(INIT_SUCCEEDED);
}

void OnDeinit (const int reason)
{
   //--- Release memory on program termination
   delete bar;
}


void OnTick ()
{
   //--- Check if the last candle was bullish
   Print( bar.IsBull(1) );
}


See also

GBar.IsBear