Monday – Friday : 9:00 AM – 6:30 PM

Color Bollinger Bands

By incorporating AFL code in Amibroker, traders can create Color Bollinger Bands that visually represent volatility and price movements. This customization, along with Amibroker data feeder, helps traders track and analyze Bollinger Bands with color-coded displays, making it easier to identify potential buy and sell signals based on Bollinger Band characteristics.

_SECTION_BEGIN("Colorf Bollinger Bands");
P = ParamField("Price field",-1);
Period = Param("Short Periods", 20, 15, 30, 1 );
Width = Param("Short Width", 2, 1, 10, 1 );

TopCond=BBandTop( P, Period, Width )>Ref(BBandTop( P, Period, Width ),-1);
BotCond=BBandBot( P, Period, Width )>Ref(BBandBot( P, Period, Width ),-1);

UpColor=IIf(TopCond AND MidCond,colorDarkBlue,colorDarkRed);
DownColor=IIf(MidCond AND BotCond,colorDarkBlue,colorDarkRed);

PlotOHLC(BBandTop( P, Period, Width ),BBandTop( P,Period, Width ),MA(C,Period),MA(C,Period), "", UpColor, styleCloud+styleNoLabel+styleNoTitle, Null, Null, Null, -2 );
PlotOHLC(MA(C,Period),MA(C,Period),BBandBot( P, Period, Width ),BBandBot( P, Period, Width ), "", DownColor, styleCloud+styleNoLabel+styleNoTitle, Null, Null, Null, -2 );

Plot(BBandBot( P, Period, Width ),"",colorLime,styleThick+styleNoTitle, Null, Null, Null, -1);
Plot(BBandTop( P, Period, Width ),"",colorLime,styleThick+styleNoTitle, Null, Null, Null, -1);
Plot(MA(C,Period),"",colorLime,styleThick+styleNoTitle, Null, Null, Null, -1);


Filter=TopCond AND MidCond AND BotCond;


_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorBrightGreen ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 

Open chat
Hi, how can I help you?