Skip to content
All library documents

Range Regime Detection with ADX, RSI, and Bollinger Band Width

Article Strategy library · Author: bigboo407

Summary

This script classifies market conditions as range-bound when ADX is below a threshold, RSI is between lower and upper bounds, and Bollinger Band width is sufficiently narrow. It also calculates a historical-volatility proxy for its dashboard, though that value does not affect the regime test. When the range criteria are met and no position is open, the strategy enters a long position. It closes the position after a fixed number of bars or if price falls more than a stated percentage below the recorded entry basis. The description frames the idea as a way to time credit spreads, but the code itself simulates a long equity-style position rather than a spread.

The script names several US equities and ETFs as intended applications and includes a commission assumption and initial capital in its strategy settings. No backtest period, performance results, or evidence of spread execution is provided. The fixed long entry does not model the payoff, volatility exposure, or risk limits of an actual credit spread, and a range classification does not ensure prices remain range-bound during the holding period. The thresholds and holding rules are configurable and would require independent evaluation across instruments and market regimes.

Key ideas

  • The range condition combines low ADX, midrange RSI, and narrow Bollinger Band width.
  • A historical-volatility proxy is displayed but does not determine entries or exits.
  • The script enters long when a range is detected and exits by duration or a percentage loss threshold.
  • Although described as credit-spread timing, the code models a long position and not a spread payoff.
  • No backtest results or evidence of performance are included.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.