Bollinger Bands Bar Coloring
May 4, 2021

The Bollinger Bands Bar Coloring indicator applies color coding to price bars based on their position relative to the Bollinger Bands basis and outer bands to highlight trend bias and volatility extremes.
Usage
The tool allows traders to visualize trend momentum and potential reversals without cluttering the main chart with line overlays. The bar coloring logic is as follows:
- Green Bars: Price is trading above the basis (SMA), indicating a bullish bias.
- Red Bars: Price is trading below the basis (SMA), indicating a bearish bias.
- Darker/Stronger Shades: These occur when price crosses outside the upper or lower Bollinger Bands, signaling overextended price action or high-momentum breakouts.
By observing changes in color, especially shifts between red and green, traders can identify potential changes in market structure and key levels of support or resistance.
Details
The script calculates the standard Bollinger Bands components: a Simple Moving Average (Basis) and two outer bands based on a standard deviation multiplier. Instead of plotting these lines, the script evaluates the relationship between the source price and these levels to dynamically update the barcolor() function. This implementation provides a cleaner interface for those who prioritize price action but still want the mathematical context of Bollinger Bands.
Settings
- Period: Defines the lookback period for the Simple Moving Average (basis) and the standard deviation calculation.
- Source: Determines which price data (e.g., Close, Open, HL2) is used for the calculations.
- Multiplier: Adjusts the width of the outer bands by set standard deviations, affecting how often price is considered to be in an "extreme" or high-momentum state.
FAQ
How do I use this without seeing the bands?
The indicator is designed to overlay directly on your price bars. It changes the candle colors themselves, so you can keep your chart clear of extra lines while still knowing exactly where price sits relative to the bands.
What do the color shifts indicate?
A shift from red to green suggests a crossover of the basis line to the upside (bullish), while a shift from green to red suggests a crossunder (bearish). These shifts often align with changes in short-to-medium term market structure.
How do I get access?
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.