Bollinger Bands with color

I would like to have the ability to select a color that fills the space between 20SMA and upper band and a different color to fill the space between 20SMA and lower band.

If I add another band on the same chart say for example with 3.0 STD, then the ability to select a color that fills the space between 2.0 STD upper band and 3.0 STD upper band and similar way to be able to select a color that fills the space between -2.0 STD lower band and -3.0 STD lower band.

Appreciate your help.

Thanks

I took the existing BBands indicator, and added basically just one Polygon type graphics object per element to make it shade between the bands. Then I layered them together with different params for some interesting results:

I made very few additional changes:

  • added parameter to change the stdDev multiplier. What you had described would only be possible if you changed that value.
  • added a fill color param
  • added another StdDev tool to the indicator definition in init

You can download the indicator here and look at the full code. You could definitely take it further if you wanted.

Thank you so much Alex for modifying this. I can use this for my purpose.

Really appreciate your help.

1 Like