Bollinger bands % Sideways indicator
Jan 29, 2021

The Bollinger bands % Sideways indicator is a market regime detection tool that differentiates between sideways and trending environments by analyzing price position and volatility relative to Bollinger Bands. This script provides visual cues to help traders identify periods of consolidation where trend-following strategies might underperform.
Usage
The indicator identifies market regimes through background coloring:
- Green Background: Indicates a "Sideways" or range-bound market. This occurs when the price remains within the Bollinger Band boundaries and the volatility of the %B value is below a specific threshold.
- Red Background: Indicates a "Trending" or high-volatility market. This occurs when price action breaks outside the standard range or exhibits significant momentum.
Traders can use this tool to filter out noise during choppy price action or to identify potential breakout points when a long-standing sideways period ends.
Details
The script is constructed using the Bollinger Band %B (BBR) formula, which measures the price's relative position between the upper and lower bands. The core logic for detecting a sideways market requires two conditions to be met:
- The price must be within the bands (BBR between 0 and 1).
- The standard deviation of the BBR values over a specific lookback period must be lower than a user-defined threshold.
By measuring the volatility of the relative price position rather than just the price itself, the indicator can more accurately pinpoint periods of true stagnation.
Settings
- Source: The price data used for calculations (typically the close).
- bbLength: The lookback period for the base Bollinger Bands SMA.
- StdDev: The multiplier for the Bollinger Band width.
- BBR Signal Smoothing: The lookback period used to calculate the standard deviation of the %B values to determine stability.
- BBR Std. threshold: The sensitivity threshold; lower values require tighter consolidation to trigger a sideways signal.
FAQ
How do I interpret the background colors? A green background suggests the market is currently range-bound or sideways, while a red background suggests the market is trending or experiencing high volatility.
Can I use this for breakout trading? Yes, traders often look for the transition from a sideways (green) state to a trending (red) state as an early signal of a potential volatility breakout.
How can I access the Bollinger bands % Sideways indicator? 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.