OPEN-SOURCE SCRIPT
Updated Multi Factor Divergence Confluence Oscillator

Multi-Factor Divergence Confluence Oscillator
What it is
This indicator detects price/oscillator divergence on four independent indicator families at the same price pivots and reports how many of them agree. The lower-pane histogram shows the signed agreement count — positive (bullish) above the zero line, negative (bearish) below — and a signal is flagged only when at least N independent families diverge at the same swing. It is a context tool that measures agreement, not a buy/sell system, and it places no orders.
Why these components are combined (and why it is not just stacked indicators)
Divergence on a single oscillator is a weak, noisy signal. The instinctive "fix" is to stack several oscillators and look for agreement — but stacking RSI, Stochastic, MACD and similar tools does not create real confluence, because they are all rate-of-change of price. They are highly correlated, so a divergence on one almost always coincides with the others. That is one witness counted several times, which feels like confirmation while adding almost no new information.
Meaningful confluence requires independent witnesses. This script therefore measures divergence on four families chosen specifically because each looks at a different dimension of the same bar, and each covers a blind spot of the others:
Momentum — Relative Strength Index. The classic rate-of-change read. It says nothing about who is transacting or how far price has travelled.
Volume — Normalized Cumulative Volume Delta. Detrended, standardized signed volume — an order-flow read that is independent of price geometry. (Signed volume is estimated; see Limitations.)
Volatility — Parabolic-SAR-to-price extension, in ATR units. How stretched the current trend leg is relative to its trailing stop, normalized by volatility — a read that ignores both momentum and volume.
Forecast — price minus its linear-regression forecast. A z-scored "how far has price departed from its own fitted path" term, independent of the three above.
All four are rescaled to share polarity (up = bullish), so a single divergence rule applies to every engine and the counts are directly comparable. Counting agreement across these families is information; counting it within one family is not — that independence is the entire reason these four are combined, rather than four momentum clones.
How the parts work together
Each enabled family is reduced to one bounded, bullish-up oscillator.
At every confirmed price swing (the families share the same price pivots), each family is asked whether it diverges there. Bearish = price makes a higher high while the oscillator makes a lower high; bullish = price makes a lower low while the oscillator makes a higher low.
The number of agreeing families becomes the signed confluence histogram, with glowing tip dots on flagged signals and a connecting line/label on the pane.
A signal flag is raised only at or above the chosen agreement threshold. That threshold can adapt to the chart timeframe — lower timeframes are noisier, so by default 1–5m require four families, 15–60m require three, and above 60m require two.
How to use it
Read the height and sign of the histogram: how many independent families diverge, and in which direction. The flag lines and the optional shaded zones mark where agreement is strong (three or more).
Treat it as context that qualifies your own analysis, not a standalone trigger. A divergence marks where price and a flow/momentum read disagree; it can resolve either way. More agreement is rarer, not guaranteed-better.
The dashboard summarizes the last signal, which families diverged, the active engines, the current threshold, and whether the signed-volume estimate is using lower-timeframe data or the proxy.
Enable/disable any family, switch between regular (reversal) and hidden (continuation) divergence, and tune the pivot, gap and threshold settings to your instrument and style.
What is original
The originality is the integration discipline, not the individual techniques: divergence is measured only across deliberately independent families on one shared set of price pivots and one comparable axis, with an explicit rule that within-family agreement is excluded. The result is a single confluence read that resists the double-counting that ordinary multi-oscillator "confluence" tools fall into, plus a timeframe-adaptive agreement threshold and an honest, configurable, multi-market implementation.
Universal across markets (configurable data source)
The Price / High / Low sources are user-selectable in Settings, so the engine runs on any symbol, asset class or timeframe — equities, futures, forex, crypto or indices. The Volume family needs a symbol that reports real volume; otherwise it falls back to a high/low/close proxy, and the dashboard shows which is active. Defaults are tuned for NSE NIFTY index futures on intraday charts; change the sources, lengths and lower timeframe for any other instrument.
Concept credits
Relative Strength Index and Parabolic SAR — J. Welles Wilder Jr. Cumulative Volume Delta, linear-regression forecasting and price/oscillator divergence are standard, publicly documented techniques. This is an original integration built around those public concepts and is not affiliated with, nor endorsed by, any originator.
Limitations (honest)
Divergence is context, not a trigger. Signed volume is estimated from lower-timeframe sub-bars (or an intrabar proxy), not exchange aggressor data, so the Volume family is an approximation and is unreliable on instruments without real volume. Divergence confirms a few bars after its pivot — inherent to honest, non-repainting pivot detection. Past behaviour does not predict future results.
Disclaimer
For research and educational purposes only. This is not financial advice and carries no guarantee of profitability or accuracy. Indicators describe past behaviour; they do not predict the future. Trading involves risk of loss. Test out-of-sample and make your own decisions.
What it is
This indicator detects price/oscillator divergence on four independent indicator families at the same price pivots and reports how many of them agree. The lower-pane histogram shows the signed agreement count — positive (bullish) above the zero line, negative (bearish) below — and a signal is flagged only when at least N independent families diverge at the same swing. It is a context tool that measures agreement, not a buy/sell system, and it places no orders.
Why these components are combined (and why it is not just stacked indicators)
Divergence on a single oscillator is a weak, noisy signal. The instinctive "fix" is to stack several oscillators and look for agreement — but stacking RSI, Stochastic, MACD and similar tools does not create real confluence, because they are all rate-of-change of price. They are highly correlated, so a divergence on one almost always coincides with the others. That is one witness counted several times, which feels like confirmation while adding almost no new information.
Meaningful confluence requires independent witnesses. This script therefore measures divergence on four families chosen specifically because each looks at a different dimension of the same bar, and each covers a blind spot of the others:
Momentum — Relative Strength Index. The classic rate-of-change read. It says nothing about who is transacting or how far price has travelled.
Volume — Normalized Cumulative Volume Delta. Detrended, standardized signed volume — an order-flow read that is independent of price geometry. (Signed volume is estimated; see Limitations.)
Volatility — Parabolic-SAR-to-price extension, in ATR units. How stretched the current trend leg is relative to its trailing stop, normalized by volatility — a read that ignores both momentum and volume.
Forecast — price minus its linear-regression forecast. A z-scored "how far has price departed from its own fitted path" term, independent of the three above.
All four are rescaled to share polarity (up = bullish), so a single divergence rule applies to every engine and the counts are directly comparable. Counting agreement across these families is information; counting it within one family is not — that independence is the entire reason these four are combined, rather than four momentum clones.
How the parts work together
Each enabled family is reduced to one bounded, bullish-up oscillator.
At every confirmed price swing (the families share the same price pivots), each family is asked whether it diverges there. Bearish = price makes a higher high while the oscillator makes a lower high; bullish = price makes a lower low while the oscillator makes a higher low.
The number of agreeing families becomes the signed confluence histogram, with glowing tip dots on flagged signals and a connecting line/label on the pane.
A signal flag is raised only at or above the chosen agreement threshold. That threshold can adapt to the chart timeframe — lower timeframes are noisier, so by default 1–5m require four families, 15–60m require three, and above 60m require two.
How to use it
Read the height and sign of the histogram: how many independent families diverge, and in which direction. The flag lines and the optional shaded zones mark where agreement is strong (three or more).
Treat it as context that qualifies your own analysis, not a standalone trigger. A divergence marks where price and a flow/momentum read disagree; it can resolve either way. More agreement is rarer, not guaranteed-better.
The dashboard summarizes the last signal, which families diverged, the active engines, the current threshold, and whether the signed-volume estimate is using lower-timeframe data or the proxy.
Enable/disable any family, switch between regular (reversal) and hidden (continuation) divergence, and tune the pivot, gap and threshold settings to your instrument and style.
What is original
The originality is the integration discipline, not the individual techniques: divergence is measured only across deliberately independent families on one shared set of price pivots and one comparable axis, with an explicit rule that within-family agreement is excluded. The result is a single confluence read that resists the double-counting that ordinary multi-oscillator "confluence" tools fall into, plus a timeframe-adaptive agreement threshold and an honest, configurable, multi-market implementation.
Universal across markets (configurable data source)
The Price / High / Low sources are user-selectable in Settings, so the engine runs on any symbol, asset class or timeframe — equities, futures, forex, crypto or indices. The Volume family needs a symbol that reports real volume; otherwise it falls back to a high/low/close proxy, and the dashboard shows which is active. Defaults are tuned for NSE NIFTY index futures on intraday charts; change the sources, lengths and lower timeframe for any other instrument.
Concept credits
Relative Strength Index and Parabolic SAR — J. Welles Wilder Jr. Cumulative Volume Delta, linear-regression forecasting and price/oscillator divergence are standard, publicly documented techniques. This is an original integration built around those public concepts and is not affiliated with, nor endorsed by, any originator.
Limitations (honest)
Divergence is context, not a trigger. Signed volume is estimated from lower-timeframe sub-bars (or an intrabar proxy), not exchange aggressor data, so the Volume family is an approximation and is unreliable on instruments without real volume. Divergence confirms a few bars after its pivot — inherent to honest, non-repainting pivot detection. Past behaviour does not predict future results.
Disclaimer
For research and educational purposes only. This is not financial advice and carries no guarantee of profitability or accuracy. Indicators describe past behaviour; they do not predict the future. Trading involves risk of loss. Test out-of-sample and make your own decisions.
Release Notes
Major upgrade — rebuilt as a multi-factor engine.This version replaces the previous design (which compared a handful of families at shared price pivots) with a broader, more general framework: it now collapses nine different "is price stretched?" factors onto a single shared standard-deviation (sigma) scale, so one set of extreme bands is valid for all of them at once.
What's new:
Nine factors, one scale: fair value (VWAP deviation), volatility (range), efficiency, positioning (basis), trend extension (SAR/ATR), momentum (RSI), equilibrium (linear-regression deviation), cycle (KST) and order flow (volume delta) — each standardized to sigma so they're directly comparable. Every factor is individually toggleable.
Consensus extremes: instead of a single line, the core read is now how many factors hit the extreme band at the same time. A consensus dot prints on the band, and an "Ext N" tag prints on price showing how many agree.
Composite + divergence: a single composite line (the mean of the active factors) is plotted, and divergence (regular and hidden) is detected between price and that composite.
Timeframe-adaptive threshold: consensus requires 4 factors on 1-minute, 3 on 2/3/5-minute, and 2 on 15-minute and above (clamped to the active-factor count; manual override available).
Auto data handling: factors whose data is unavailable (no volume → VWAP / order flow; no reference symbol → basis) are skipped automatically and the threshold scales down.
Cleaner pane + slimmer dashboard: the individual factor lines are now an optional ribbon (off by default), leaving just the composite, the shared extreme bands, signals and divergence. The status table is condensed to composite status plus four key readouts, and is background-adaptive for light/dark charts.
Universal & configurable: price/high/low, VWAP and reference-symbol sources are all inputs, so it runs on any instrument and market; defaults target NSE NIFTY index futures intraday.
As always: this is a context/confluence tool, not a signal generator — and because several factors share inputs, a high consensus count reflects partly correlated reads, so treat it as confirmation, not a trigger. Educational only; not financial advice.
Release Notes
Upgrade Writeup (v1.0 → v1.4)## Summary
The original indicator collapsed nine factors onto one sigma scale, counted how many hit the extreme together (consensus), and detected divergence on their mean (the composite). It was sound but had one self-admitted gap: it *asserted* that consensus extremes precede reversals without ever *measuring* it. The upgrade closes that gap, sharpens the divergence read, fixes a scaling flaw the measurement exposed, and brings the script to a publishable state. No new factors were added — every change either measures existing output or corrects how it is read.
A note on scope discipline: eight candidate scripts were reviewed for inclusion. Four (VWAP / Range / Efficiency / Basis oscillators) were already lenses 1–4 of the confluence and were rejected as duplication. A low-lag strength oscillator was rejected as a redundant momentum read. Two large ML / regime pipelines were rejected as too heavy to merge. The only thing worth taking was the calibration concept they shared — and that is what was built.
---
## Version history
### v1.1 — Forward calibration harness (Phase 1)
**Problem it solved.** The indicator's own honesty note said consensus extremes "should be MEASURED, not assumed," yet provided no measurement.
**What was added.** A harness that logs every `consUp` / `consDn` consensus event on confirmed bars and resolves it a fixed horizon later against a `k × ATR` move, then compares the hit rate to the unconditional same-horizon base rate. The dashboard gained Hit % / Base % / Edge rows.
**Key design points.** A per-side cooldown (`calGap`) so a persistent extreme is logged once rather than every bar (otherwise overlapping copies of one event dominate the statistics). A hypothesis toggle — Exhaustion (fade) vs Continuation (follow) — so the user can test which behaviour actually holds. Honest framing: in-sample, overlapping windows, no costs; the Edge is context, not a backtest.
### v1.2 — Extreme-gated divergence + reversal engine (Phase 2)
**Problem it solved.** The composite divergence engine fired from anywhere in the range, producing chart clutter and low-quality signals.
**What was added.** Three upgrades to the composite divergence engine, all ported from the single-factor scripts and all toggleable:
- **`reqExtreme`** — a regular divergence only counts when the composite is at/beyond its OB-OS band at the pivot, where divergence carries the most meaning. This removed the mid-range noise.
- **`useOscPivot`** — detection anchors to the composite's own swing (`highest`/`lowest` across the pivot window) while the line still draws from the raw pivot value, catching swings the plain offset missed.
- **In-band reversal engine** — a dot when the composite turns back from inside the extreme band, plus a dashboard row and alerts.
### v1.3 — Composite self-scaling (correction)
**Problem it solved.** Multi-timeframe testing (1m/2m/5m/15m) showed reversals firing once every 779–974 bars on higher timeframes and divergences nearly vanishing. Root cause: the composite is a **mean** of nine z-scores, so its standard deviation is well below 1 and it rarely reaches the per-lens ±1.5 / ±2.5 bands. Phase 2's gating was effectively inert above 2-minute.
**What was fixed.** The composite's divergence gate, reversal band, and line colour now self-scale to the composite's **own** rolling standard deviation (`compWin`, `compObK`, `compExtK`). Phase-2 reads now fire at a sensible cadence on every timeframe. Critically, consensus counting still runs on the individual lenses at `extSigma` — that was correct and was left untouched. A toggle restores the fixed-band behaviour.
### v1.3.1 — Plot-budget trim
**Problem it solved.** Headroom under TradingView's 64-plot limit (relevant when running alongside other indicators or merging).
**What was done.** Trimmed from 27 to 23 plot-outputs with zero loss of function: the zero line became an `hline` (which does not count), a redundant composite-glow layer was dropped, and two gate guide lines were removed (the line colour already conveys that state). The header now documents the per-feature plot budget so any future merge can be planned. *Note: the diagnostic finding here was that a reported "67 plots" came from merging the confluence with duplicate single-factor scripts — the dedup, not the trim, was the real fix.*
### v1.4 — Close the loose end + pre-publication finalization
**Problem it solved.** Phase 2 added two new signal types (divergence, reversal) but the harness still only scored consensus — the same "asserted but unmeasured" gap Phase 1 was built to close, reopened.
**What was added.** The harness was generalized from one scored class to **three**: Consensus, Divergence, Reversal. Each event is a directional hypothesis (consensus per the fade/follow toggle; divergence follows its own direction; reversal fades the extreme), and each class gets its own n / Hit % / Edge row against a shared, event-weighted base rate. The dashboard now reads all three side by side.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.