May 12: BBS Trading Expert now available with the "BAND INDICATORS" DVD!
Follow my forex trades with signal provider BandBreak5.
Read my S&P500 and FOREX EUR/USD weekly forecast with new trading rules and a NEW chart template!
Sneak Peek my "Long Term Trading ETF's" article that will be published July 2012 in S&C magazine.
TradersLibrary Top 10 List 2011 and 2010
WINNER "Favorite Article" in the S&C Readers' Choice Award 2010 and 2011 and finalist in 2012. Thank You!
AXIOM business books awards, bronze medal for my book! Thank You!
Sylvain Vervoort
WINNER 2010 and 2011 favorite article Readers' Choice Award.
AXIOM Business Books Awards, bronze medal.
HOME Back to MetaStock Formulas Overview
Bollinger Bands are from John Bollinger and are mentioned in his book “Bollinger on Bollinger Bands” (Bollinger, 2001).
The Bollinger Bands in the following figure consist of a set of three curves drawn in relation to price data. The middle band is usually a simple 20-bars moving average, which serves as the base for the upper and lower bands.

Upper Band = Middle Band + 2 * 20-period closing prices standard deviation
Lower Band = Middle Band - 2 * 20-period closing prices standard deviation
The use of the standard deviation moving average is a method to measure price volatility. With trending prices, the bands will be wider as a result of the higher volatility in price, moving farther away from the mean, whereas during consolidation periods, bands will be narrower as a result of smaller price moves closer to the mean. This changing bandwidth is used for volatility-based trading opportunities.
%b is a measure of where price is in relation to the outer Bollinger bands and therefore strongly related to volatility. %b is created as an oscillator to show overbought and oversold situations when price is moving close or beyond the upper or lower Bollinger bands.
This is the basic %b formula:
%b = (close – lower band) / (Upper band – lower band)
For the basic %b formula, we multiply the %b result with 100 to get an oscillator moving between 0 and 100 (with overshoots):
{The upper band}
upper:=2*Stdev( CLOSE,20 ) + Mov(CLOSE,20,SIMPLE);
{The lower band}
lower:=Mov(CLOSE,20,SIMPLE)-2*Stdev( CLOSE,20);
{%b}
percb:=(C-lower)/(upper-lower)*100;
percb
Applying some math we can simplify the formula with the following result for the basic (MetaStock) formula for a Bollinger Bands %b indicator using closing prices and a simple moving average:
{BB%b_C_S}
percb:=(C+2*Stdev(C,20)-Mov(C,20,S))/(4*Stdev(C,20))*100;
percb

As you can see in the above indicator it is leading most of the time, showing high levels, low levels, and eventually divergences prior to turning points in price. Unfortunately it is a very choppy oscillator. Finding the more important turning points and trying to trade with the %b indicator day by day is not an easy task.
Using a heikin ashi re-calculated closing price, a TEMA average and the zero-lagging technique, we can create this indicator with more clear turning points.
{Sylvain Vervoort SVE_BB%b}
period:=Input("%b period: ",1,100,18);
TeAv:=Input("Tema average: ",1,30,8);
afwh:= Input("Standard deviation high ",.1,5,1.6);
afwl:= Input("Standard deviation Low ",.1,5,1.6);
afwper:= Input("Standard deviation period ",1,200,63);
haOpen:=(Ref((O+H+L+C)/4,-1) + PREV)/2;
haC:=((O+H+L+C)/4+haOpen+Max(H,haOpen)+Min(L,haOpen))/4;
TMA1:= Tema(haC,TeAv);
TMA2:= Tema(TMA1,TeAv);
Diff:= TMA1 - TMA2;
ZlHA:= TMA1 + Diff;
percb:=(Tema(ZLHA,TeAv)+2*Stdev(Tema(ZLHA,TeAv),period)- Mov(Tema(ZLHA,TeAv),period,WEIGHTED))/(4*Stdev(Tema(ZLHA,TeAv),period))*100;
percb;
50+afwh*Stdev(percb,afwper);
50-afwl*Stdev(percb,afwper);
50
Compare in the following figure the original BB%b with the smoothed version SVE_BB%b.

We will split this chart in two parts. The first part ends March 9, 2009. In November there was a big price drop and some recuperation. Next price is moving further downwards. What does the SVE_BB%b indicator tell you in that period?

In the above figure you can see at the start a big price drop and a first reaction until the beginning of December in a convergent move with lower tops in price and the indicator. Price now continues the down move in a phase (1) and is making a lower top in price, but a higher top in the indicator beginning of January 2009. This is an inverse or hidden divergence pointing in the direction of a continuation of the previous downtrend. And once more, price continues the down move until half of February when you can see again the same situation with phase (2), with lower tops in price and higher tops in the indicator. Another hidden divergence telling you that price will continue the down move. Price is making lower bottoms, but now you can see higher bottoms with phase (3) in the indicator. This is a normal divergence telling you that you should expect a price up move now. Note that price is bottoming with doji’s in the candlestick chart and price has been moving within narrow Bollinger bands indicating low volatility for more than 3 months already. Clearly you can open a position here with a very good risk-to-reward ratio, with a buy at $2.53 and an initial closing price stop at $2.38. An ideal entry for opening a long position with a risk of only 6%.
Let’s continue with the next figure, the second part of the original chart. Phase (3) actually brought a trend reversal and started a new price up move. There is a nice convergent up move until the beginning of may with phase (4), showing a negative divergence with a higher top in price but a lower top in the indicator. This points in the direction of a price reversal.

Time to take the more than 100% profit! What follows is a correction back to the lower Bollinger band. The end of this correction is showing with phase (5) a positive divergence with lower bottoms in price and higher bottoms in the indicator. This is pushing price up again. You could go for a new long position here. The tops in price and indicator beginning of June, end phase (6) with a negative divergence, pushing price down for a bigger correction. It now looks like the end of this correction is reached with a new positive divergence in phase (7).
HOME Back to MetaStock Formulas Overview