Bollinger Band Bandwidth

#1
Hello All,

I am looking for an AFL code in order to plot BB bandwidth , explore and scan according to the parameters i can define.

Does anyone have BB bandwidth formula?

Thanks for your helps..:clapping:

Best Regards..
 

HULK

Active Member
#2
Dear

It is not recommended to enter in to trade looking after only one indicator i.e BBand.

Always combined (Mix) various other indicator along with BBband for best result.

Hulk
 
#3
Dear

It is not recommended to enter in to trade looking after only one indicator i.e BBand.

Always combined (Mix) various other indicator along with BBband for best result.

Hulk
I think his is looking for code and not trade recommendations
I may be wrong but that is what I see
 
#5
Dear

It is not recommended to enter in to trade looking after only one indicator i.e BBand.

Always combined (Mix) various other indicator along with BBband for best result.

Hulk
You are right Hulk.
BB band is not my single indicator to give trade decision.
I will use bandwidth scan-explore to find potential stock breakouts to get in my watchlist.

Do you have BB bandwidth afl code to share?

All the best..
 
#7
Just to plot is here
_____________________________

_SECTION_BEGIN("Bollinger Bandwidth");
a1=Param("period",20,10,50,1,0);
a2=Param("Standard Deviation",2,1.5,2.5,0.1,0);
a3=BBandTop(Close, a1, a2);
a4=BBandBot(Close, a1, a2);
a5=a3-a4;
a6=MA(Close,14);
a7=a5/a6*100;
Plot( a7,"Bollinger Bandwidth",ParamColor( "color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
 
#8
Just to plot is here
_____________________________

_SECTION_BEGIN("Bollinger Bandwidth");
a1=Param("period",20,10,50,1,0);
a2=Param("Standard Deviation",2,1.5,2.5,0.1,0);
a3=BBandTop(Close, a1, a2);
a4=BBandBot(Close, a1, a2);
a5=a3-a4;
a6=MA(Close,14);
a7=a5/a6*100;
Plot( a7,"Bollinger Bandwidth",ParamColor( "color", colorCycle ), ParamStyle("Style") );
_SECTION_END();
Thank you minitrader,:clapping:

How can we add scan and explore functions?

All my best..
 

HULK

Active Member
#9
MBZD

This is for U And All
Note:- As I told u don't enter in to trade only after looking at BBand Width indicator , Mix other indictor for best result

//MBZD Bollinger Bands Width + Scan + Exp BY Hulk
_SECTION_BEGIN("Bollinger_Bands_width");
pds=Param("Periods",20,2,200);
sd=Param("Band Width",2, 0.01,10);
alpha=2/(pds+1);
mt=AMA( C, alpha );
ut=AMA( mt, alpha );
dt=((2-alpha)*mt-ut)/(1-alpha);
mt2=AMA(abs(C-dt), alpha );
ut2=AMA(mt2,alpha );
dt2=((2-alpha)*mt2-ut2)/(1-alpha);
but=dt+sd*dt2;
blt=dt-sd*dt2;

Plot( but, "Upper band", colorLightGrey, styleLine | styleDots, maskAll );
Plot( blt, "Lower band", colorLightGrey, styleLine | styleDots, maskAll);
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

//Note:- If you change parameter of BBands then change manually also in Explorer, otherwise you will NOT get desire result.


_SECTION_BEGIN("Explorer");

bb= C > BBandTop( C, 20, 2) AND Ref (C,-1) < Ref(BBandTop( C, 20, 2),-1);
bb1= C < BBandBot( C, 20, 2) AND Ref (C,-1) > Ref(BBandBot( C, 20, 2),-1);
bb_status= WriteIf(BB, "AboveTop", WriteIf(bb1, "BelowBottom", "Neutral"));
bb_Col=IIf(bb, colorGreen, IIf(bb1, colorRed, colorLightGrey));


/* RESULTS */
Filter = MA(Volume,20) > 10000;
AddColumn( Close, "Close " );
AddColumn( Volume, "Volume " );
AddTextColumn(bb_status, "BBand", 1, colorWhite, bb_Col);

Buy = Cross(C , but);
Sell = Cross(blt , C);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
shape = Buy * shapeUpTriangle + Sell * shapeDownTriangle;
PlotShapes( shape, IIf( Buy, colorWhite, colorCustom12 ), IIf( Buy, Low, High ) );

_SECTION_END();

SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel color ",colorDarkGrey)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel color upper half", colorBlack),
ParamColor("Inner panel color lower half", colorDarkOliveGreen)); // color of inner panel
Title = EncodeColor(colorWhite)+ "BBW+SCAN+EXP By HULK" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V);

HULK
 
#10
MBZD

This is for U And All
Note:- As I told u don't enter in to trade only after looking at BBand Width indicator , Mix other indictor for best result

//MBZD Bollinger Bands Width + Scan + Exp BY Hulk
_SECTION_BEGIN("Bollinger_Bands_width");
pds=Param("Periods",20,2,200);
sd=Param("Band Width",2, 0.01,10);
alpha=2/(pds+1);
mt=AMA( C, alpha );
ut=AMA( mt, alpha );
dt=((2-alpha)*mt-ut)/(1-alpha);
mt2=AMA(abs(C-dt), alpha );
ut2=AMA(mt2,alpha );
dt2=((2-alpha)*mt2-ut2)/(1-alpha);
but=dt+sd*dt2;
blt=dt-sd*dt2;

Plot( but, "Upper band", colorLightGrey, styleLine | styleDots, maskAll );
Plot( blt, "Lower band", colorLightGrey, styleLine | styleDots, maskAll);
Plot( C, "Close", ParamColor("Color", colorBlack ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() );
_SECTION_END();

//Note:- If you change parameter of BBands then change manually also in Explorer, otherwise you will NOT get desire result.


_SECTION_BEGIN("Explorer");

bb= C > BBandTop( C, 20, 2) AND Ref (C,-1) < Ref(BBandTop( C, 20, 2),-1);
bb1= C < BBandBot( C, 20, 2) AND Ref (C,-1) > Ref(BBandBot( C, 20, 2),-1);
bb_status= WriteIf(BB, "AboveTop", WriteIf(bb1, "BelowBottom", "Neutral"));
bb_Col=IIf(bb, colorGreen, IIf(bb1, colorRed, colorLightGrey));


/* RESULTS */
Filter = MA(Volume,20) > 10000;
AddColumn( Close, "Close " );
AddColumn( Volume, "Volume " );
AddTextColumn(bb_status, "BBand", 1, colorWhite, bb_Col);

Buy = Cross(C , but);
Sell = Cross(blt , C);
Buy=ExRem(Buy,Sell);
Sell=ExRem(Sell,Buy);
shape = Buy * shapeUpTriangle + Sell * shapeDownTriangle;
PlotShapes( shape, IIf( Buy, colorWhite, colorCustom12 ), IIf( Buy, Low, High ) );

_SECTION_END();

SetChartOptions(0,chartShowArrows|chartShowDates);
SetChartBkColor(ParamColor("Outer panel color ",colorDarkGrey)); // color of outer border
SetChartBkGradientFill( ParamColor("Inner panel color upper half", colorBlack),
ParamColor("Inner panel color lower half", colorDarkOliveGreen)); // color of inner panel
Title = EncodeColor(colorWhite)+ "BBW+SCAN+EXP By HULK" + " - " + Name() + " - " + EncodeColor(colorRed)+ Interval(2) + EncodeColor(colorWhite) +" - " + Date() +" - "+"\n" +EncodeColor(colorYellow) +"Op-"+O+" "+"Hi-"+H+" "+"Lo-"+L+" "+
"Cl-"+C+" "+ "Vol= "+ WriteVal(V);

HULK
Thanks Hulk..

you are really Hulk..:D:clapping:

I will check out if there is something wrong..
 

Similar threads