Bollinger Bands Formula (Chart Controls)
The Bollinger Bands formula calculates the standard deviation above and below a simple moving average of the data. Since standard deviation is a measure of volatility, a large standard deviation indicates a volatile market, and a smaller standard deviation indicates a calmer market.
Formula Details
Syntax
Chart.DataManipulator.FinancialFormula(
FinancialFormula.BollingerBands,
"Period,StdDev",
"Price",
"UpperBand,LowerBand")
Parameters
This formula takes two required parameters.
- Period
Period for calculating the moving average for the Bollinger Bands.
- StdDev
The number of standard deviations for calculating the upper and lower bands.
Input Values
This formula takes one input Y value.
- Price
The price for which the Bollinger Bands are calculated.
Output Value
This formula outputs two Y values.
- UpperBand
Upper Bollinger Band.
- LowerBand
Lower Bollinger Band.
Remarks
The Range chart type is a convenient chart type to display the formula output. You can also use the Line chart type to display the upper envelope and lower envelope as two data series.
Example
The following example takes input from Series1's second Y value (Series1:Y2) and outputs the Bollinger Bands on Series2 (Series2:Y, Series2:Y2). It specifies a period of 20 days and takes two standard deviations.
Chart1.DataManipulator.FinancialFormula (FinancialFormula.BollingerBands, "20,2", "Series1:Y2", "Series2:Y,Series2:Y2")
Chart1.DataManipulator.FinancialFormula (FinancialFormula.BollingerBands, "20,2", "Series1:Y2", "Series2:Y,Series2:Y2");
See Also
Reference
System.Windows.Forms.DataVisualization.Charting
System.Web.UI.DataVisualization.Charting