Sideways Strategy DMI + Bollinger Bands
Nov 9, 2021

The Sideways Strategy DMI + Bollinger Bands indicator identifies range-bound market conditions to execute mean-reversion trades using a combination of trend strength filtering and price envelope crossovers.
Usage
This strategy is designed for sideways or range-bound markets where traditional trend-following systems often fail. It utilizes the Directional Movement Index (DMI) to confirm a lack of trend and Bollinger Bands to identify entry and exit points.
- Long Entry: A long position is opened when the DMI indicates a sideways market (absolute difference between DI+ and DI- is below 20) and the price crosses above the lower Bollinger Band.
- Long Exit: The position is closed when the price crosses back down below the upper Bollinger Band, suggesting the mean-reversion move has been exhausted.
The strategy is particularly effective on medium timeframes, such as the 1-hour chart. Users can adjust the Bollinger Band parameters to better fit the volatility of specific assets.
Details
The strategy relies on two core technical concepts:
- Trend Filtering: By calculating the absolute difference between the Positive Directional Indicator (DI+) and the Negative Directional Indicator (DI-), the script determines if the market is trending. A low difference indicates that neither bulls nor bears have significant control, confirming a sideways environment.
- Mean Reversion: Bollinger Bands serve as dynamic price channels. In a non-trending market, price tends to oscillate between these bands. Entering at the lower band and exiting at the upper band captures these cyclical fluctuations.
Settings
Backtest Window
- From Month/Day/Year: Sets the starting date for the backtest period.
- Thru Month/Day/Year: Sets the ending date for the backtest period.
- Show Date Range: Toggles the background highlight for the active backtest window.
Bollinger Bands
- BB Length: Determines the lookback period (SMA) used for calculating the bands (default is 20).
- Source: The price input used for calculations (default is Close).
- StdDev: The standard deviation multiplier that defines the width of the bands (default is 2.0).
- Offset: Shifts the Bollinger Bands forward or backward in time on the chart.
FAQ
How do I access Sideways Strategy DMI + Bollinger Bands?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
What is the best timeframe for this strategy?
Based on backtesting, the 1-hour timeframe is generally preferred. While shorter timeframes can work for volatile assets, they may result in more frequent false signals and higher volatility in returns.
Can I change the sideways market threshold?
In the current version, the DMI difference threshold is set to 20. To change this value, you would need to adjust the calculation in the script logic to suit different market environments.
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.