The Bollinger Band Width Ratio (BBWR) is a technical analysis indicator derived from Bollinger Bands, which are used to measure market volatility. BBWR helps traders identify periods of low and high volatility, which can signal potential trading opportunities.
1. Understanding Bollinger Bands
Bollinger Bands consist of three lines:
Middle Band: A simple moving average (SMA), typically set at 20 periods.
Upper Band: The middle band plus a multiple (usually 2) of the standard deviation.
Lower Band: The middle band minus the same multiple of the standard deviation.
The bands expand when volatility increases and contract when volatility decreases.
2. Bollinger Band Width (BBW)
Bollinger Band Width is calculated as:
This value represents the relative width of the bands in comparison to the moving average.
3. Bollinger Band Width Ratio (BBWR)
The Bollinger Band Width Ratio (BBWR) is a normalized version of BBW, often calculated using a long-term moving average of the Bollinger Band Width. The general formula is:
BBWR compares the current Bollinger Band Width to its historical average, making it easier to spot extreme contractions or expansions in volatility.
4. How Traders Use BBWR
Low BBWR Values: Indicate narrow Bollinger Bands, signaling low volatility. This often precedes a strong breakout or trending move (also called a "squeeze").
High BBWR Values: Suggest wide Bollinger Bands, indicating high volatility. This often occurs after a large price move, suggesting possible consolidation or trend exhaustion.
Divergence and Trend Analysis: Traders watch for divergences between price and BBWR to anticipate potential reversals or trend continuations.
5. Trading Strategies with BBWR
Breakout Trading: When BBWR is at historical lows, traders prepare for a breakout in either direction.
Trend Confirmation: A rising BBWR during a strong trend confirms sustained volatility and strength.
Mean Reversion: A very high BBWR may indicate overextension, leading to potential reversals.
6. Conclusion
BBWR is a valuable tool for identifying periods of contraction and expansion in market volatility. It helps traders anticipate breakouts, trend continuations, and reversals. However, it is most effective when used alongside other indicators such as RSI, MACD, or price action patterns.
Code:
using Tickblaze.Scripts.Indicators;
namespace CC.Indicators.BBWR;
/// <summary>
/// Bollinger Bands Width Ratio [BBWR]
/// </summary>
public partial class cBBWR : Indicator
{
[Parameter("Source")]
public ISeries<double> Source { get; set; }
[Parameter("Period"), NumericRange(1, 999, 1)]
public int Period { get; set; } = 20;
[Parameter("Min/Max Period"), NumericRange(1, 999, 1)]
public int MinMaxPeriod { get; set; } = 100;
[Parameter("Multiplier"), NumericRange(0, int.MaxValue, 0.01)]
public double Multiplier { get; set; } = 2;
[Parameter("Smoothing Type")]
public MovingAverageType SmoothingType { get; set; } = MovingAverageType.Simple;
[Plot("Main")]
public PlotSeries Main { get; set; } = new(Color.Blue, LineStyle.Solid);
[Plot("Max")]
public PlotSeries Max { get; set; } = new(Color.Green, LineStyle.Solid);
[Plot("Min")]
public PlotSeries Min { get; set; } = new(Color.Red, LineStyle.Solid);
private MovingAverage _movingAverage;
private StandardDeviation _standardDeviation;
public cBBWR()
{
Name = "Bollinger Bands Width Ratio";
ShortName = "CC.BBWR";
IsOverlay = false;
}
protected override void Initialize()
{
_movingAverage = new MovingAverage(Source, Period, SmoothingType);
_standardDeviation = new StandardDeviation(Source, Period, SmoothingType);
}
private double HighestT(int index, int period)
{
double highest = double.MinValue;
int per = Math.Min(period, index + 1);
for (int i = 0; i < per; i++)
{
if (Main[index-i] > highest) highest = Main[index-i];
}
return highest;
}
private double LowestT(int index, int period)
{
double lowest = double.MaxValue;
int per = Math.Min(period, index + 1);
for (int i = 0; i < per; i++)
{
if (Main[index-i] < lowest) lowest = Main[index-i];
}
return lowest;
}
protected override void Calculate(int index)
{
var movingAverage = _movingAverage[index];
var bandDistance = _standardDeviation[index] * Multiplier;
Main[index] = 2 * bandDistance/movingAverage;
Max[index] = HighestT(index - 1,MinMaxPeriod);
Min[index] = LowestT(index - 1,MinMaxPeriod);
}
}