BBandLower

Modified on 2019/04/09 15:53 by Administrator — Categorized as: Standard Indicators

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


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:
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.Low[bar] < BBandLower.Series( Close, 10, 1.50 )[bar] ) SetBarColor( bar, Color.Lime ); } } } }