# BollingerTrend

#### Birdseye

##### Member
a bit rough yet, but helps to determine trend

it's based on Bollinger bands.

basically works like this...if the middle of the bollingerbands are up compared to the previous, the histogram is green, unless other criteria is met

_SECTION_BEGIN("BollingerTrend");
P = C;
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
bbt = BBandTop( P, Periods, Width );
bbb = BBandBot( P, Periods, Width );
bbm = ((bbt +bbb )/2);
_SECTION_END();

_SECTION_BEGIN("Histogram");
myarray=bbm-Ref(bbm,-1);
trendUP=(bbm>Ref(bbm,-1) AND NOT (C<bbm OR H<bbm AND C<O)) OR (C>bbm AND L>bbm AND C>O);
trendDown=(bbm<Ref(bbm,-1) AND NOT (C>bbm AND L>bbm AND C>O)) OR (C<bbm AND H<bbm AND C<O);
Style2 = ParamStyle("Style2") | styleHistogram |styleArea ;;
Plot( myarray, "Histogram",IIf( trendUP, colorSeaGreen, IIf( trendDown, colorOrange, colorLavender )), Style2 , -0.5, 100 );
_SECTION_END();

#### Birdseye

##### Member
same thing, but now more smooth; goal is just prevent trading against the trend

_SECTION_BEGIN("Bollinger Bands");
P = AMA( Ref( C, -1 ), 0.5 );
Periods = Param("Periods", 15, 2, 100, 1 );
Width = Param("Width", 2, 0, 10, 0.05 );
bbt = BBandTop( P, Periods, Width );
bbb = BBandBot( P, Periods, Width );
bbm = ((bbt +bbb )/2);
_SECTION_END();

_SECTION_BEGIN("Histogram");
myarray=bbm-Ref(bbm,-1);
trendUP=(bbm>Ref(bbm,-1) AND NOT (C<bbm OR H<bbm AND C<O)) OR (C>bbm AND L>bbm AND C>O);
trendDown=(bbm<Ref(bbm,-1) AND NOT (C>bbm AND L>bbm AND C>O)) OR (C<bbm AND H<bbm AND C<O);
Style2 = ParamStyle("Style2") | styleHistogram |styleArea ;;
Ho = AMA( Ref( myarray, -1 ), 0.5 );
Plot( Ho , "Histogram",IIf( trendUP, colorSeaGreen, IIf( trendDown, colorOrange, colorLavender )), Style2 , -0.5, 100 );
_SECTION_END();

#### manoj2012

##### On Probation
AFL required for BollingerTrend for band to be displayed around price-candles

Bollinger Band in Amibroker is displayed in separate window below.

How do I edit the AFL so that Bollinger band is made around the price-Candles instead of separate window below as it is in chartnexus chart as compared to Amibroker.

http://imgur.com/gallery/lh0h9Qw/new

##### Well-Known Member
Re: AFL required for BollingerTrend for band to be displayed around price-candles

Bollinger Band in Amibroker is displayed in separate window below.

How do I edit the AFL so that Bollinger band is made around the price-Candles instead of separate window below as it is in chartnexus chart as compared to Amibroker.

http://imgur.com/gallery/lh0h9Qw/new
Bollinger Bands are for overlaying on Price.

Just Drag & Drop the Bollinger Band Indicator on the price chart in Amibroker [that means don't double click on BB Indicator otherwise it opens in another sheet]. You will see the chart just like you see in the image . With parameters you can change the Bollinger bands settings.

Last edited: