Combining muliple Bollinger Bands


Category:
0
0

I use 20, 50, and 100 period Bollinger bands as an indicator and am interested when price is outside all 3 bands.  Is there a way to only have the most extreme period BB print on the price chart for each candle so that only 1 band instead of all 3?

Thanks

Marked as spam
Posted by (Questions: 2, Answers: 0)
Asked on July 11, 2019 1:23 pm
86 views
0
Private answer

This should do the trick. I kept this very brief. I have clients that have paid for less complex solutions than this. So I omitted user inputs and other items that would be included in a full featured solution. Screenshot below shows the results.

def bbOneUpper = BollingerBands(length = 20).UpperBand;
def bbOneLower = BollingerBands(length = 20).LowerBand;
def bbTwoUpper = BollingerBands(length = 50).UpperBand;
def bbTwoLower = BollingerBands(length = 50).LowerBand;
def bbThreeUpper = BollingerBands(length = 100).UpperBand;
def bbThreeLower = BollingerBands(length = 100).LowerBand;
plot bbUpper = Max(bbOneUpper, Max(bbTwoUpper, bbThreeUpper));
plot bbLower = Min(bbOneLower, Min(bbTwoLower, bbThreeLower));

Attachments:
Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on July 14, 2019 3:42 pm