BollingerBands Construction in an EA

 

Hi,

I need help again.

----------------------------------

int time2 = 5; //used timeframe

double derivation=2 ; // derivation

double Bollinger,BolValue;

Bollinger = iBands(NULL,0,4*time2,derivation,0,PRICE_TYPICAL,0,0);

BolValue = iBandsOnArray(array[],0,derivation,0,0,0);

----------------------------------

I am working on an EA. Now I need the BollingerBands as a filter for my signals.

How can i construct the real values of the BollingerBands as I see, when I drop the Indicator on the chart?

The first double called "Bollinger" seems to be the MA in the middle of the BBs.

So I think the "BolValue" is the pos. and neg. difference between the middle-MA and the Bands - right?

So, if thats right - what do i have to choose for ARRAY[] ?. If that must be loop or somethink, can someone tell me the whole loop?.

 
 
justize:
Hi,

I need help again.

----------------------------------

int time2 = 5; //used timeframe

double derivation=2 ; // derivation

double Bollinger,BolValue;

Bollinger = iBands(NULL,0,4*time2,derivation,0,PRICE_TYPICAL,0,0);

BolValue = iBandsOnArray(array[],0,derivation,0,0,0);

----------------------------------

I am working on an EA. Now I need the BollingerBands as a filter for my signals.

How can i construct the real values of the BollingerBands as I see, when I drop the Indicator on the chart?

The first double called "Bollinger" seems to be the MA in the middle of the BBs.

So I think the "BolValue" is the pos. and neg. difference between the middle-MA and the Bands - right?

So, if thats right - what do i have to choose for ARRAY[] ?. If that must be loop or somethink, can someone tell me the whole loop?.

Firstly, you should know the formula of BB:

- UpBB = MA(N) + deviation*StdDev(N)

- DnBB = MA(N) - deviation*StdDev(N)

where N - period of BB

Second, if you wish to receive difference between Upper and Lower bands(or BBWidth) then you should use the following formula:

BBWidth = UpBB - DnBB = 2*deviation*StdDev(N).

Standard Deviation(iStdDev(...)) you can find in the built-in indicators.

 

the middle of the bollinger matches is the same as a MA try placing a SMA20 over a SMA20 bollinger band. the higher and lower boll value can be gotten with

iBands(NULL,0,20,2,0,PRICE_LOW,MODE_UPPER,0)

iBands(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0)

so just take a SMA from the high, or the low from the SMA. hope that helps (i didnt really read the question.

 

Thanks, that was it

 
 

yeah you can change to any price, the info i got was from the MT4 help file, as is;

iBands(symbol,timeframe,period,deviation,bands_shift,applied_price,mode,shift)

Reason: