Bollinger band indicator's middle band.

 

Hi all,

Please i need help on how to get the value of Bollinger band indicator's middle band for my EA code.

Any help would be highly appreciated.

Thanks.

 
Take upper and lower band, sum it and devide 2.
 
Roger wrote >>
Take upper and lower band, sum it and devide 2.

Thanks Rogers,

But i'm still learning coding,

please, how do i sum up the 2 bands and divide by 2?,

expecting your reply.

Thanks a lot.

 

double up,low,mid;

up=iBand(NULL,0,20,2,0,PRICE_LOW,MODE_UPPER,0);

low=iBand(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0);

mid=(up+low)/2;

 

Roger wrote >>

Take upper and lower band, sum it and devide 2.


double up,low,mid;

up=iBand(NULL,0,20,2,0,PRICE_LOW,MODE_UPPER,0);

low=iBand(NULL,0,20,2,0,PRICE_LOW,MODE_LOWER,0);

mid=(up+low)/2;

wow


Why not just

mid = iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, 0);

btw, bb indicator function name is iBands()

 
Irtron wrote >>

wow

Why not just

It's too easy, task was - "value of Bollinger band indicator's middle band" :-)

btw, bb indicator function name is iBands()

My fault, wrote by heart.
 

We had this many times before why not use

mid=iBand(NULL,0,20,2,0,PRICE_LOW,MODE_MAIN,0);

That way everything to do with BB comes from BB calls.

 
Roger wrote >>

It's too easy, task was - "value of Bollinger band indicator's middle band" :-)

My fault, wrote by heart.

Hi Rogers and Irtron,

I want to say a BIG " thank you" to you guys for helping me out,both of you were right,because i also confirmed that

iMA(NULL, 0, 20, 0, MODE_SMA, PRICE_CLOSE, 0); has the same value with Bollinger band's middle band.

thank you so much.