A follower asked about plotting multiple sets of Bollinger Bands in AFL. I had a little spare time this morning, so here you go:
// AFL to plot three sets of Bollinger Bands®
// By John Bollinger
// https://www.BollingerBands.com
// Copyright Bolinger Capital Management 2018
//
// Data to use, deafault to close
P = ParamField("Price field", -1 );
// User BB period selection
Periods1 = Param("Periods 1", 10, 2, 100, 1 );
Periods2 = Param("Periods 2", 20, 2, 100, 1 );
Periods3 = Param("Periods 3", 50, 2, 100, 1 );
// User BB width selection
Width1 = Param("Width 1", 2, 0, 10, 0.05 );
Width2 = Param("Width 2", 2, 0, 10, 0.05 );
Width3 = Param("Width 3", 2, 0, 10, 0.05 );
// User BB color selection
ColorUpper = ParamColor("Color 1", colorRed );
ColorMiddle = ParamColor("Color 2", colorBlue );
ColorLower = ParamColor("Color 3", colorGreen );
// User BB line selection
Style1 = ParamStyle("Style 1", styleDots );
Style2 = ParamStyle("Style 2", styleLine );
Style3 = ParamStyle("Style 3", styleDashed );
// Plot the first set of bands
Plot( BBandTop( P, Periods1, Width1 ), "upperBB1", ColorUpper, Style1 );
Plot( MA(P, Periods1), "middleBB1", ColorMiddle, Style1 );
Plot( BBandBot( P, Periods1, Width1 ), "lowerBB1", ColorLower, Style1 );
// Plot the second set of bands
Plot( BBandTop( P, Periods2, Width2 ), "upperBB2", ColorUpper, Style2 );
Plot( MA(P, Periods2), "middleBB2", ColorMiddle, Style2 );
Plot( BBandBot( P, Periods2, Width2 ), "lowerBB2", ColorLower, Style2 );
// Plot the third set of bands
Plot( BBandTop( P, Periods3, Width3 ), "upperBB3", ColorUpper, Style3 );
Plot( MA(P, Periods3), "middleBB3", ColorMiddle, Style3 );
Plot( BBandBot( P, Periods3, Width3 ), "lowerBB3", ColorLower, Style3 );
// That's all folks!
Enjoy,
John