Previous Next

GBar

The GBar class provides quick access to various candlestick helpers.


Create and destroy the class

To create the class and destroy it when the program ends, 5 simple steps are necessary. You can see these steps in the example.

Example:

//--- Include Glib
#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)
{
   //--- Free Memory on Exit
   delete bar;
}

From this point on you can use the class functions.


Class functions

Return value

Function call

Function

void

Init()

To change the symbol.

double

Bid()

Returns the current Bid.

double

Ask()

Returns the current Ask.

double

Spread()

Returns the current spread

double

Hight()

Returns the highest point of a candle.

double

Low()

Returns the lowest point of a candle.

double

Open()

Returns the opening price of a candle.

double

Close()

Returns the closing price of a candle.

bool

IsBull()

Checks if the candle is bullish.

bool

IsBear()

Checks if the candle is bearish.

double

MiddleHighLow()

Returns the price in the middle of the highest and lowest point of a candle.

double

MiddleOpenClose()

Returns the price in the middle of the opening and closing price.

double

CandleFullSpread()

Returns the spread of a candle from the lowest to the highest point.

double

CandleBodySpread()

Returns the candle spread from the opening to the closing price.

bool

PeakUpInto()

Checks if a candle "peaks" upwards into a value

bool

PeakDownInto()

Checks if a candle "peaks" downwards into a value