Bollinger Bands are not converted properly when I assign their value to Variable and make the MQ5 export:
It is presented properly for MQ4 and for Pseudocode but for MQ5 export, the "iBand" is used in place of sqBand please see below:
What is interesting when I use BollingerBand functions under IF CONDITIONS sections it is working well.
Pseudocode - CORRECT:
//--------------------------------------------------------------------
// Trading rule: NewCandleAction (On Bar Open)
//--------------------------------------------------------------------
if Is Bar Open
{
// Action #1
BB_H = BollingerBands(Main chart,BollingerBandsPeriod, BollingerBandsDvt, PRICE_CLOSE).Upper[BollingerBandsShift];
// Action #2
BB_L = BollingerBands(Main chart,BollingerBandsPeriod, BollingerBandsDvt, PRICE_CLOSE).Lower[BollingerBandsShift];
}
MQ4 Code - CORRECT:
//------------------------
// Rule: NewCandleAction
//------------------------
if (sqIsBarOpen()
&& sqIsBarOpen())
{
// Action #1
BB_H = sqBands(NULL,0, BollingerBandsPeriod, BollingerBandsDvt, 0, PRICE_CLOSE, 0, BollingerBandsShift);
// Action #2
BB_L = sqBands(NULL,0, BollingerBandsPeriod, BollingerBandsDvt, 0, PRICE_CLOSE, 1, BollingerBandsShift);
}
MQ5 Code - INCORRECT - it should be SQ function used and not the default iBands one :
It is also not diferrentiating Low Band from High Band below.
//------------------------
// Rule: NewCandleAction
//------------------------
if (_sqIsBarOpen == true
&& (_sqIsBarOpen == true)
)
{
// Action #1
BB_H = iBands(NULL,0, BollingerBandsPeriod, 0, BollingerBandsDvt, PRICE_CLOSE);
// Action #2
BB_L = iBands(NULL,0, BollingerBandsPeriod, 0, BollingerBandsDvt, PRICE_CLOSE);
}