# Range Detector

Automatically detects trading ranges and draws their extremities and midline in real time. Extremity colors tell the story at a glance (blue while unbroken, green after an upside break, red after a downside break) and past levels extend forward as support and resistance. A hands-off way to find and trade range-bound markets.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Oct 3, 2023.
- Access: free.
- Concepts: [Trading Range](https://www.luxalgo.com/library/concept/trading-range/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=cmpwn53e70075vhsg8or5zmnb
- Page: https://www.luxalgo.com/library/indicator/range-detector/

**Range Detector** finds [sideways ranges](https://www.luxalgo.com/library/concept/trading-range/) automatically and draws them as they form, sparing traders the manual work of boxing consolidation by hand. Each zone is anchored back to where the range began, a gray background stamps the exact bar of detection, and a dotted midline marks the equilibrium between the extremities.

## How to Trade the Range Detector?

- **Blue extremities**: the range is intact. Both boundaries are unbroken and edge-to-edge rotation remains in play.
- **Green extremities**: price has broken above the upper boundary, pointing to a potential uptrend.
- **Red extremities**: price has broken below the lower boundary, hinting at a developing downtrend.
- **Dotted midline**: the halfway mark between range maximum and minimum, a useful reference for judging rotations.

Extremities extend until a new range is detected, so previously broken levels keep serving as support and resistance long after the range resolves. When a fresh range overlaps an existing one, the two are merged and the earlier extremities are updated, keeping the chart coherent even in choppy conditions.

## Range Detector Settings

- **Minimum Range Length**: the minimum number of bars required before a range can be detected.
- **Range Width**: an ATR multiplier controlling detected width. Lower values isolate smaller ranges, higher values can produce false positives.
- **ATR Length**: the lookback of the Average True Range that defines that width.

## Frequently Asked Questions

### How does the Range Detector identify a range?

It checks whether every price within a user-defined window stays confined between the window's mean plus or minus an ATR-derived value. Once that holds for enough bars, the zone is highlighted in real time with its extremities and midline.

### Can I trade breakouts with it?

Yes, the extremity coloring is the cue, turning green or red the moment price escapes the zone. For a candle-level companion, [Range Breakout Signals (Intrabar)](https://www.luxalgo.com/library/indicator/range-breakout-signals-intrabar/) times breaks from individual ranging candles.

### What does the Range Detector cost?

Nothing. It is free in the LuxAlgo Library, and you can load it into Quant, our coding agent, from this page to explore it further. You can also copy the source code from this page and run it anywhere Pine Script® runs.

## Related indicators

- [Wave Consolidation](https://www.luxalgo.com/library/indicator/wave-consolidation/) (Trading Range): markdown at https://www.luxalgo.com/library/indicator/wave-consolidation.md
- [Bart Pattern](https://www.luxalgo.com/library/indicator/bart-pattern/) (Trading Range): markdown at https://www.luxalgo.com/library/indicator/bart-pattern.md
- [Range Sentiment Profile](https://www.luxalgo.com/library/indicator/range-sentiment-profile/) (Trading Range): markdown at https://www.luxalgo.com/library/indicator/range-sentiment-profile.md
- [Range Intelligence Suite](https://www.luxalgo.com/library/indicator/range-intelligence-suite/) (Trading Range): markdown at https://www.luxalgo.com/library/indicator/range-intelligence-suite.md
- [Range Average Retest Model](https://www.luxalgo.com/library/indicator/range-average-retest-model/) (Trading Range): markdown at https://www.luxalgo.com/library/indicator/range-average-retest-model.md
- [Range Breakout Signals (Intrabar)](https://www.luxalgo.com/library/indicator/range-breakout-signals-intrabar/) (Trading Range): markdown at https://www.luxalgo.com/library/indicator/range-breakout-signals-intrabar.md
- [Fibonacci Ranges (Real-Time)](https://www.luxalgo.com/library/indicator/fibonacci-ranges-real-time/) (Trading Range): markdown at https://www.luxalgo.com/library/indicator/fibonacci-ranges-real-time.md
- [Retest & Break Setup](https://www.luxalgo.com/library/indicator/retest-break-setup/) (Breakout-pullback-continuation): markdown at https://www.luxalgo.com/library/indicator/retest-break-setup.md

---

Source: https://www.luxalgo.com/library/indicator/range-detector/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
