# N Bar Reversal Detector

N Bar Reversal Detector is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Generalizes the classic three-bar reversal to any sequence length: a reference bar and the N-1 bars after it set the prevailing push, and the next bar breaking the reference bar's extreme flags the turn, with an Enhanced mode demanding a close beyond it. Confirmed patterns project support and resistance, and MA cloud, Supertrend, or Donchian filters align signals with or against the trend.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Sep 4, 2024.
- Access: free.
- Concepts: [Three-bar Reversal](https://www.luxalgo.com/library/concept/three-bar-reversal/) (primary), [Key Reversal](https://www.luxalgo.com/library/concept/key-reversal/)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=cmpwn41mc005nvhsgr5k9ymps
- Page: https://www.luxalgo.com/library/indicator/n-bar-reversal-detector/

**N Bar Reversal Detector** extends the [three-bar reversal](https://www.luxalgo.com/library/concept/three-bar-reversal/) into a configurable N-bar engine: you choose how many candles build the setup instead of settling for three. A bullish signal forms when an initial high bar leads a run of N-1 downtrending bars and the next bar's high takes out that first bar's high; the bearish case mirrors it at the lows. In Enhanced mode that breakout bar must close beyond the first bar's extreme, a stricter demand in the spirit of a [key reversal](https://www.luxalgo.com/library/concept/key-reversal/), where the close does the confirming.

## How to Trade the N Bar Reversal Detector?

- **Normal pattern**: the breakout bar's extreme breaches the sequence's first bar, the earliest form of the reversal cue.
- **Enhanced pattern**: the breakout bar closes beyond the first bar's extreme, trading immediacy for conviction.
- **Projected levels**: patterns that confirm against price action draw support and resistance boundaries, reference points for entries, stops, and continuation checks.
- **Trend filter**: show only patterns agreeing with the prevailing trend for continuation trading, or only counter-trend ones for fading, judged by your choice of Moving Average Cloud, Supertrend, or Donchian Channel.

The Min Percentage of Required Candles input decides how many of the first N-1 candles must lean the right way before a pattern qualifies, letting you tighten or relax detection to match conditions.

## N Bar Reversal Detector Settings

- **Pattern Type**: detect "Normal" patterns, "Enhanced" patterns, or both.
- **Reversal Pattern Sequence Length**: N, how many bars back the reference bar sits; the pattern spans that bar, the N-1 bars after it, and the breakout bar, so the minimum of 2 is the classic three-bar case.
- **Min Percentage of Required Candles**: the share of the first N-1 candles that must align with the prior trend.
- **Derived Support and Resistance**: Level draws the projected levels; None turns them off.
- **Trend indicator settings**: Moving Average Cloud type with fast/slow lengths, Supertrend ATR length and factor, and Donchian Channel length are each configurable.

## Frequently Asked Questions

### Why use N bars instead of the classic three?
Three-bar turns fire often and can bury a chart in noise; stretching the sequence demands a longer one-sided push before the break, which tends to isolate the more meaningful exhaustion points. The adjustable length lets each market and timeframe earn its own setting.

### Can it confirm signals from other reversal tools?
Yes. Running it beside [Reversal Signals](https://www.luxalgo.com/library/indicator/reversal-signals/) works well, since agreement between two independent reversal reads at the same level is stronger evidence than either alone.

### How is the N Bar Reversal Detector priced?
It is not: the detector is one of the LuxAlgo Library's free tools, and Quant, our coding agent, can run it for you starting right here on the page.

## Related indicators

- [Three Bar Reversal Pattern](https://www.luxalgo.com/library/indicator/three-bar-reversal-pattern/) (Three-bar Reversal): markdown at https://www.luxalgo.com/library/indicator/three-bar-reversal-pattern.md
- [Candle 2 Closure](https://www.luxalgo.com/library/indicator/candle-2-closure/) (Two-bar Reversal): markdown at https://www.luxalgo.com/library/indicator/candle-2-closure.md
- [Long Wick Detector](https://www.luxalgo.com/library/indicator/long-wick-detector/) (Pin Bar): markdown at https://www.luxalgo.com/library/indicator/long-wick-detector.md
- [The Strat](https://www.luxalgo.com/library/indicator/the-strat/) (Inside Bar): markdown at https://www.luxalgo.com/library/indicator/the-strat.md
- [Wide-range Bar](https://www.luxalgo.com/library/indicator/wide-range-bar/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/wide-range-bar.md
- [Engulfing Bar](https://www.luxalgo.com/library/indicator/engulfing-bar/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/engulfing-bar.md
- [CBC Flip with Targets and Filters](https://www.luxalgo.com/library/indicator/cbc-flip-with-targets-and-filters/) (Two-bar Reversal): markdown at https://www.luxalgo.com/library/indicator/cbc-flip-with-targets-and-filters.md
- [Exhaustion Bar](https://www.luxalgo.com/library/indicator/exhaustion-bar/) (Chart & Candlestick Patterns): markdown at https://www.luxalgo.com/library/indicator/exhaustion-bar.md

---

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