Colour Coded Bollinger Bands
Oct 15, 2019

The Colour Coded Bollinger Bands indicator provides a visual enhancement to traditional Bollinger Bands by dynamically shading the bandwidth based on expansion and contraction cycles. This tool aims to help traders quickly identify periods of increasing or decreasing volatility through intuitive color transitions.
Usage
The indicator can be used to gauge the current state of market volatility. When the bands are filled with a green color, it indicates that the bandwidth is increasing, suggesting a period of market expansion or a potential breakout. Conversely, a red fill indicates that the bandwidth is decreasing, signaling a period of market contraction or consolidation.
Traders can use these visual cues to:
- Identify "squeezes" (prolonged red periods) which often precede significant price movements.
- Confirm trending strength when expansion (green) aligns with price movement away from the basis.
- Anticipate slowing momentum when the bands begin to contract (turn red) after a strong move.
Details
The script calculates standard Bollinger Bands using a Simple Moving Average (SMA) as the basis and a multiplier applied to the standard deviation for the upper and lower bands. The unique feature of this implementation is the comparison of the current bandwidth to the previous bar's bandwidth.
If the distance between the upper band and the basis (and the lower band and the basis) is greater than it was in the previous period, the script assigns a growth color. If the distance has decreased, it assigns a contraction color. This logic is applied to the band plots and the background fill to provide a cohesive visual experience.
Settings
- Length: Determines the lookback period used for both the SMA (basis) and the standard deviation calculation.
- Source: Sets the price data used for calculations (e.g., Close, Open, HL2).
- Multiplier: Adjusts the number of standard deviations the upper and lower bands are placed from the basis.
FAQ
How do I interpret the colors?
A green fill represents expansion (increasing bandwidth/volatility), while a red fill represents contraction (decreasing bandwidth/volatility).
What alerts are included?
The script includes built-in alerts for price crossing the upper band, the lower band, and the center basis line.
How can I access Colour Coded Bollinger Bands?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.