Page History: BBandLower
Compare Page Revisions
Page Revision: 2019/04/09 15:51
Syntax
public BBandLower(DataSeries source, int period, double stdDevs, string description)
public static BBandLower Series(DataSeries source, int period, double stdDevs)
public static double Value(int bar, DataSeries source, int period, double stdDevs)
Parameter Description
source |
Price series |
period |
Indicator calculation period |
stdDevs |
Number of standard deviations |
Description
Bollinger Bands® are a type of price envelope developed by John Bollinger. Bollinger Bands® are envelopes that are plotted at a standard deviation level above and below a simple moving average of the price. Because the distance of the bands is based on standard deviation, they adjust to volatility swings in the underlying price.
Bollinger Bands® accept 3 parameters, the source DataSeries, period and Standard Deviations, stdDevs. The recommended values are 20 for period, and 2 for standard deviations, although other combinations offer effective results as well.
Bollinger Bands® help determine whether prices are high or low on a relative basis. They are used in pairs, both upper and lower bands and in conjunction with a moving average. Further, the pair of bands are not intended to be used on their own. Use them to confirm signals given with other indicators. For example,
RSI and Bollinger Bands® are a good combination.
Interpretation
- When the bands tighten as volatility decreases, expect a sharp move in price. This may begin a trending move. Watch out for a false move in opposite direction which reverses before the proper trend begins.
- When the bands separated by an unusual large amount, volatility increases and any trend that may be in place may be ending.
- Prices normally have a tendency to bounce within the bands envelope, touching one band then moving to the other band. You can use this for profit targets. For example, if prices bounces of the lower band then cross above the moving average the upper band then becomes the profit target.
- Price can exceed or hug a band envelope for prolonged periods during strong trends. On divergence with a momentum oscillator you should consider taking profits.
- A strong trend continuation can be expected when the price moves out of the bands. However if prices move immediately back inside the band, then the suggested strength is negated.
Calculation
First calculate and plot a simple moving average. Calculate the standard deviation using the same data used in the simple moving average. For the upper band, add the standard deviation to the moving average, for lower band, subtract the standard deviation from the moving average.
Typical values used:
- Short term: 10 day moving average, bands at 1.5 standard deviations.
- Medium term: 20 day moving average, bands at 2 standard deviations.
- Long term: 50 day moving average, bands at 2.5 standard deviations.
Note: The version of Bollinger Bands in the Standard.Indicators was changed to the
StdDevCalculation.Sample method so that it matches the Version 4 indicator.
(Version 5.5 and up)
Example
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using WealthLab;
using WealthLab.Indicators;
namespace WealthLab.Strategies
{
public class MyStrategy : WealthScript
{
protected override void Execute()
{
PlotSeries( PricePane, BBandLower.Series( Close, 10, 1.50 ), Color.DarkBlue, LineStyle.Solid, 2 );
// Flag bars that have penetrated the lower BBand
for(int bar = 10; bar < Bars.Count; bar++)
{
if( Bars.Lowbar < BBandLower.Series( Close, 10, 1.50 )bar )
SetBarColor( bar, Color.Lime );
}
}
}
}