Previous Next

GBar.IsBear()

Determines whether a candle is bearish.

bool  GBar.IsBear(
   int              shift,                     // Offset
   ENUM_TIMEFRAMES  timeFrame = PERIOD_CURRENT // Timeframe of the value
);

Parameter

shift

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

timeFrame

[in]  The timeframe of the candle.

Return value

Returns true if the requested candle is bearish.


Example:

//--- include the 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 shutdown
   delete bar;
}


void OnTick ()
{
   //--- determines if the last candle was bearish
   Print( bar.IsBear(1) );
}


See also

GBar.IsBull