Sideways detection bollinger bands
Aug 6, 2021

The Sideways detection bollinger bands indicator identifies market conditions by analyzing price position relative to Bollinger Bands and measuring volatility smoothing to distinguish between trending and ranging environments. This tool provides a visual background overlay to help traders filter out low-volatility "noise" and focus on active market trends.
Usage
The Sideways detection bollinger bands indicator can be used to determine whether the current market environment is suitable for trend-following strategies or mean-reversion tactics. When the market is detected as "Trending," the background changes color (defaulting to green), suggesting that price is pushing outside standard deviations or exhibiting high volatility. When the market is "Sideways," the background changes (defaulting to red), indicating price is compressed within the bands.
Traders should use this as a filter alongside other indicators:
- Trend Confirmation: Use the indicator to confirm a breakout before entering a position.
- Noise Reduction: Avoid entering trend-based trades when the indicator signals a sideways market.
- Volatility Analysis: Observe how price reacts when the ratio smooths out or spikes beyond the thresholds.
Details
The script operates by calculating a ratio based on the current price relative to the upper and lower Bollinger Bands. It specifically looks for two conditions to identify a trending market:
- Price Extremes: If the price moves outside the Bollinger Bands (ratio < 0 or > 1), it is immediately classified as trending.
- Volatility Smoothing: The script applies a standard deviation to the Bollinger Band ratio over a specific period (Signal Smoothing). If this smoothed value exceeds a user-defined threshold, it suggests significant movement is occurring, even if the price is currently within the bands.
Settings
Main Settings
- Source: The price source used for the Bollinger Band calculations (default is Close).
- Length: The lookback period for the Simple Moving Average and Standard Deviation used in the bands.
- StdDev: The multiplier for the Bollinger Bands width.
- Signal Smoothing: The lookback period used to calculate the standard deviation of the Bollinger Band ratio.
- Std. threshold: The sensitivity level for detecting a trend based on the smoothed ratio; higher values require more volatility to trigger a trending state.
FAQ
How do I access the Sideways detection bollinger bands indicator?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Can this indicator be used on any timeframe?
Yes, the indicator can be applied to any timeframe, though users may need to adjust the "Length" and "Std. threshold" settings to account for the different volatility profiles of intraday versus daily charts.
Does a "Trending" signal indicate the direction of the trend?
No, this indicator is non-directional. It identifies that the market is moving with significant momentum or volatility but does not specify if the trend is bullish or bearish. Direction should be determined using moving averages or other trend-following tools.
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.