# Hidden Divergence

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

Scans confirmed price swings against RSI, Stochastic, CCI, MACD or any external series for hidden divergence, a higher low in price against a lower oscillator low and the bearish mirror, gated by a structure (HH/HL) or higher-timeframe MA trend filter. Signals draw lines on both panes, label the confirming swing, and anchor dashed invalidation levels. Defaults: RSI 14 with 5/5 swing confirmation.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 22, 2026.
- Access: free.
- Concepts: [Hidden Divergence](https://www.luxalgo.com/library/concept/hidden-divergence/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=ohb2b1gmjq5c93iyb4g48jgk
- Page: https://www.luxalgo.com/library/indicator/hidden-divergence/

**Hidden Divergence** is the definitive clean scanner for [hidden divergence](https://www.luxalgo.com/library/concept/hidden-divergence/), the continuation geometry where the oscillator, rather than price, owns the more extreme print. At confirmed swing lows it looks for price defending a higher low while the gauge prints a lower low; at swing highs, for a lower price high against a higher oscillator high. A trend filter enforces the precondition (there must be a trend to continue) and each signal draws its lines on both panes, labels the confirming swing, and extends a dashed invalidation level from the anchoring pivot.

## How to Trade the Hidden Divergence?

- **Hidden Bull label**: a pullback in an uptrend pushed the oscillator under its prior swing low while price held a higher low, continuation entry timing.
- **Hidden Bear label**: the downtrend mirror, printed at a lower high.
- **Invalidation level break**: a close beyond the anchoring swing falsifies the premise; the level stops extending and the alert fires.
- **No trend, no signal**: the default structure filter demands a prior higher high before hidden bullish, a prior lower low before hidden bearish.

Alerts cover both signal types and both invalidations.

## Hidden Divergence Settings

- **Oscillator** (default RSI) with **Length** (default 14): the momentum gauge whose swings are compared.
- **MACD Fast / Slow / Signal** (defaults 12 / 26 / 9): for the MACD modes.
- **External Source** (default close): scan any other indicator's plot.
- **Left Bars / Right Bars** (defaults 5 / 5): swing confirmation requirements.
- **Max Bars Between Swings** (default 60): swings further apart are not compared.
- **Trend Filter** (default Structure (HH/HL)): swing structure, a higher-timeframe average (**MA Timeframe** D, **Length** 50, **MA Type** EMA), or none.
- **Style toggles**: oscillator lines, price lines, labels and invalidation levels, all on.

## Frequently Asked Questions

### How is hidden divergence different from regular divergence?
In regular divergence price owns the extreme print and the pattern hunts turns; in the hidden variant the oscillator owns it, showing the trend soaked up the counter-move. The [Divergence Variants & Confirmation](https://www.luxalgo.com/library/indicator/divergence-variants-and-confirmation/) build lays the full grammar out side by side.

### Why do signals appear bars after the swing?
A swing only exists once the required bars have printed on its right side (five by default) so detection carries that delay. Deliberately so: lines drawn to unconfirmed pivots would repaint.

### Which oscillator should I pick?
The geometry is identical across all of them, so the choice is cadence: RSI at 14 is the balanced default, smoother gauges print fewer but cleaner patterns, External scans any plotted series.

## Related indicators

- [Oscillator Matrix](https://www.luxalgo.com/library/indicator/luxalgo-oscillator-matrix/) (Regular Bullish/bearish Divergence): markdown at https://www.luxalgo.com/library/indicator/luxalgo-oscillator-matrix.md
- [RSI Divergence: Out-of-Sample Optimizer](https://www.luxalgo.com/library/indicator/rsi-divergence-out-of-sample-optimizer/) (Regular Bullish/bearish Divergence): markdown at https://www.luxalgo.com/library/indicator/rsi-divergence-out-of-sample-optimizer.md
- [HTF Reversal Divergences](https://www.luxalgo.com/library/indicator/htf-reversal-divergences/) (Regular Bullish/bearish Divergence): markdown at https://www.luxalgo.com/library/indicator/htf-reversal-divergences.md
- [Divergence Variants & Confirmation](https://www.luxalgo.com/library/indicator/divergence-variants-and-confirmation/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/divergence-variants-and-confirmation.md
- [LuxAlgo - Screener (OSC)](https://www.luxalgo.com/library/indicator/luxalgo-screener-osc/) (Regular Bullish/bearish Divergence): markdown at https://www.luxalgo.com/library/indicator/luxalgo-screener-osc.md
- [RSI Candlestick Oscillator](https://www.luxalgo.com/library/indicator/rsi-candlestick-oscillator/) (Overbought/oversold): markdown at https://www.luxalgo.com/library/indicator/rsi-candlestick-oscillator.md
- [Adaptive Bounds RSI](https://www.luxalgo.com/library/indicator/adaptive-bounds-rsi/) (Overbought/oversold): markdown at https://www.luxalgo.com/library/indicator/adaptive-bounds-rsi.md
- [Momentum Expansion vs Contraction](https://www.luxalgo.com/library/indicator/momentum-expansion-vs-contraction/) (Momentum & Oscillators): markdown at https://www.luxalgo.com/library/indicator/momentum-expansion-vs-contraction.md

---

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