User login

  

Bollinger Bands

Introduction

Bollinger Bands are volatility bands placed above and below a moving average. Volatility is based on the standard deviation, which changes a volatility increase and decreases. The bands automatically widen when volatility increases and narrow when volatility decreases. This dynamic nature of Bollinger Bands also means they can be used on different securities with the standard settings. For signals, Bollinger Bands can be used to identify M-Tops and W-Bottoms or to determine the strength of the trend. Signals derived from narrowing BandWidth are discussed in the chart school article on BandWidth.

Bollinger Bands consist of a middle band with two outer bands. The middle band is a simple moving average that is usually set at 20 periods. A simple moving average is used because a simple moving average is also used in the standard deviation formula. The look-back period for the standard deviation is the same as for the simple moving average. The outer bands are usually set 2 standard deviations above and below the middle band.

Settings can be adjusted to suit the characteristics of particular securities or trading styles. Bollinger recommends making small incremental adjustments to the standard deviation multiplier. Changing the number of periods for the moving average also affects the number of periods used to calculate the standard deviation. Therefore, only small adjustments are required for the standard deviation multiplier. An increase in the moving average period would automatically increase the number of periods used to calculate the standard deviation and would also warrant an increase in the standard deviation multiplier. With a 20-day SMA and 20-day Standard Deviation, the standard deviation multiplier is set at 2. Bollinger suggests increasing the standard deviation multiplier to 2.1 for a 50-period SMA and decreasing the standard deviation multiplier to 1.9 for a 10-period SMA.

Signal: W-Bottoms

W-Bottoms were part of Arthur Merrill's work that identified 16 patterns with a basic W shape. Bollinger uses these various W patterns with Bollinger Bands to identify W-Bottoms. A "W-Bottom" forms in a downtrend and involves two reaction lows. In particular, Bollinger looks for W-Bottoms where the second low is lower than the first, but holds above the lower band. There are four steps to confirm a W-Bottom with Bollinger Bands. First, a reaction low forms. This low is usually, but not always, below the lower band. Second, there is a bounce towards the middle band. Third, there is a new price low in the security this low holds above the lower band. The ability to hold above the lower band on the test shows less weakness on the last decline. Fourth, the pattern is confirmed with a strong move off the second low and a resistance break.

Signal: M-Tops

M-Tops were also part of Arthur Merrills work that identified 16 patterns with a basic M shape. Bollinger uses these various M patterns with Bollinger Bands to identify M Bottoms. According to Bollinger, tops are usually more complicated and drawn out than bottoms. Double tops, head-and-shoulders patterns and diamonds represent evolving tops.

In its most basic form, an M-Top is similar to a double top. However, the reaction highs are not always equal. The first high can be higher or lower than the second high. Bollinger suggests looking for signs of non-confirmation when a security is making new highs. This is basically the opposite of the W-Bottom. A non-confirmation occurs with three steps. First, a security forges a reaction high above the upper band. Second, there is a pullback towards the middle band. Third, prices move above the prior high, but fail to reach the upper band. This is a warning sign. The inability of the second reaction high to reach the upper band shows waning momentum, which can foreshadow a trend reversal. Final confirmation comes with a support break or bearish indicator signal.

Signal: Walking the Bands

Moves above or below the bands are not signals per se. As Bollinger puts it, moves that touch or exceed the bands are not signals, but rather "tags". On the face of it, a move to the upper band shows strength, while a sharp move to the lower band shows weakness. Momentum oscillators work much the same way. Overbought is not necessarily bullish. It takes strength to reach overbought levels and overbought conditions can extend in a strong uptrend. Similarly, prices can "walk the band" with numerous touches during a strong uptrend. Think about it for a moment. The upper band is 2 standard deviations above the 20-period simple moving average. It takes a pretty strong price move to exceed this upper band. An upper band touch that occurs after a Bollinger Band confirmed W-Bottom would signal the start of an uptrend. Just as a strong uptrend produces numerous upper band tags, it is also common for prices to never reach the lower band during an uptrend. The 20-day SMA sometimes acts as support. In fact, dips below the 20-day SMA sometimes provide buying opportunities before the next tag of the upper band.

Conclusions

Bollinger Bands reflect direction with the 20-period SMA and volatility with the upper/lower bands. As such, they can be used to determine if prices are relatively high or low. According to Bollinger, the bands should contain 88-89% of price action, which makes a move outside the bands significant. Technically, prices are relatively high when above the upper band and relatively low when below the lower band. However, relatively high should not be regarded as bearish or as a sell signal. Likewise, relatively low should not be considered bullish or as a buy signal. Prices are high or low for a reason. As with other indicators, Bollinger Bands are not meant to be used as a stand alone tool. Chartists should combine Bollinger Bands with basic trend analysis and other indicators for confirmation.

 

Display/hide source code
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using PTLRuntime.NETScript;
using System.Drawing;
 
namespace ind
{
        //---------------------------------------------------
        // Project: Bollinger
        // Type: Indicator
        // Author: PFSoft LLC
        // Company: PFSoft LLC /www.pfsoft.com/
        // Copyright: (C) PFSoft LLC Dnepropetrovsk. Ukraine
        // Created: Nov, 28,2006
        //---------------------------------------------------
    
    public class BB : NETIndicator
    {
  
        public BB()
            : base()
        {
                ProjectName = "Bollinger Band";
                Comments = "Provides a relative definition of high and low based on standard deviation and a simple moving average";
            SetIndicatorLine("line1", Color.Green, 1, LineStyle.SimpleChart);
            SetIndicatorLine("line2", Color.Red, 1, LineStyle.SimpleChart);
            SeparateWindow = false;
            }
                public const int  LOWER_BAND = 0;
                public const int  UPPER_BAND = 1;
 
        [InputParameter("Sources prices for MA", 0, new object[] {
             "Close", ptl.CLOSE,
             "Open", ptl.OPEN ,
             "High", ptl.HIGH,
             "Low", ptl.LOW,
             "Typical", ptl.TYPICAL,
             "Medium", ptl.MEDIUM,
             "Weighted", ptl.WEIGHTED}
        )]
        public int SourcePrices = ptl.LOW;
                
                [InputParameter("Type of moving average", 1, new object[] {
            "Simple", "SMA",
            "Exponential", "EMA",
            "Modified", "MMA",
                "Linear Weighted", "LWMA"}
        )]
        public string MAType = "SMA"; 
        
        [InputParameter("Period of MA for envelopes", 2)]
        public int MAPeriod = 5;
        [InputParameter("Value of confidence interval", 3, 1)]
        public double d = 1.0;
 
        public override void OnQuote()
        {
                int count = platform.BarsCount(platform.Symbol, platform.Period); 
                // Current amount of bars on the history
            // Getting amount of bars on the history
                    // Checking, if current amount of bars 
                    // more, than period of moving average. If it is
                    // then the calculation is possible
                    if(count>MAPeriod)
                    {
                        double maValue = platform.iCustom(MAType, platform.Symbol, platform.Period, 0, 0, MAPeriod, SourcePrices);
                        double summa = 0.0;
                        // Calulation of the summa
                        int i = 0; 
                        while(i<MAPeriod)
                        {
                            summa += ptl.MathSqr(ptl.GetPrice(SourcePrices, i) - maValue);
                            i++;
                        };
                        // Calculation of deviation value
                        summa = d*ptl.MathSqrt(summa/MAPeriod);
                        // Setting value
                        platform.SetValue(LOWER_BAND, 0, maValue - summa);
                        platform.SetValue(UPPER_BAND, 0, maValue + summa);
                 }
        }
    }   
}
12345

Comments