Bollinger Bands values are not exported properly to MQ5 (iBand function is used in place of sqBand)

 

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);

 

  }

 

Attachments
No attachments
  • Votes 0
  • Project AlgoWizard
  • Type Bug
  • Status Fixed
  • Priority Normal

History

p
#1

pitro

01.05.2020 22:46

Task created

p
#2

pitro

03.05.2020 23:45
Update to the case: I have added  Round (  x  , 5 ) function to make variable value limited to 5 digits after comma. The result was positive and the code exported to MQ5 format contains sqBands function and not iBands one.

Votes: 0

Drop files to upload

or

choose files

Max size: 5MB

Not allowed: exe, msi, application, reg, php, js, htaccess, htpasswd, gitignore

...
Wait please