OPEN-SOURCE SCRIPT
Multi-Oscillator Divergence Scanner [Quantum Algo]

Multi-Oscillator Divergence Scanner [Quantum Algo]
====================================================
🔶 OVERVIEW
Multi-Oscillator Divergence Scanner is a confluence-based divergence indicator that scans up to seven classic oscillators simultaneously — Relative Strength Index, Moving Average Convergence Divergence, Stochastic Oscillator, Commodity Channel Index, On Balance Volume, Money Flow Index, and Momentum — and displays the result on two synchronized canvases at once. Divergence lines, graded labels, and reaction zones are drawn directly on the price chart, while a dedicated pane below plots a Composite Oscillator built from every enabled engine, with the same divergence lines mirrored onto the composite itself. You see both slopes of every divergence — price disagreeing with momentum — in one glance.
The problem this script solves is selective divergence trading. Any single oscillator produces frequent divergences, and most of them fail. Requiring multiple mathematically independent engines — momentum-based, volume-based, and volatility-normalized — to diverge at the same confirmed swing filters the noise down to setups where disagreement between price and participation is broad, not incidental.
🔶 WHAT IS A DIVERGENCE?
A divergence occurs when price prints a new extreme but an oscillator refuses to confirm it. A regular bullish divergence forms when price makes a lower low while the oscillator makes a higher low — a classic reversal condition. A regular bearish divergence forms when price makes a higher high while the oscillator makes a lower high. Hidden divergences are the continuation counterparts: price makes a higher low while the oscillator makes a lower low (hidden bullish), or price makes a lower high while the oscillator makes a higher high (hidden bearish). This scanner detects all four types on confirmed swing pivots.
🔶 WHAT IS THE COMPOSITE OSCILLATOR?
The Composite Oscillator is the consensus reading of every engine you enable. Bounded oscillators (Relative Strength Index, Stochastic, Money Flow Index) contribute their native zero-to-one-hundred values; unbounded engines (Moving Average Convergence Divergence histogram, On Balance Volume, Momentum) are range-normalized over a configurable lookback; the Commodity Channel Index is rescaled onto the same axis. The average of all enabled engines plots as a single gradient line with overbought and oversold guides, a midline fill, and divergence lines drawn directly on it — so the pane shows aggregate momentum from the same engines that vote on every signal, not a separate calculation.
🔶 WHY THIS SCRIPT IS ORIGINAL
1. True multi-engine confluence. Divergences are not detected on one oscillator and decorated with others. All seven engines are evaluated independently at every confirmed pivot, and a signal only exists when the minimum confluence count you set is reached.
2. Dual-canvas mirroring. Every qualified divergence is drawn twice: on price, and on the Composite Oscillator in the pane, connected at the same two pivots. Both slopes of the disagreement are visible simultaneously — the visual proof that defines a divergence.
3. Consensus composite pane. The pane line is not one more oscillator; it is the averaged, normalized voice of the exact engines doing the scanning, colored by a gradient between the oversold and overbought guides.
4. Full transparency on every label. Each signal prints its strength as a diamond meter and lists the exact oscillators that diverged (for example: RSI · OBV · MFI). You always know why a signal exists — nothing is a black box.
5. Strength-scaled visuals. Divergence lines thicken with confluence on both canvases, and signals reaching the Strong threshold upgrade to the accent color, so chart hierarchy communicates quality instantly.
6. Reaction zones with a life cycle. Every regular divergence projects a volatility-sized zone around its pivot (measured in Average True Range). Zones gray out automatically the moment price invalidates them, so the chart always distinguishes live zones from dead ones.
7. Divergence pressure gauge. A decaying pressure model accumulates bullish and bearish divergence weight over time, giving a one-glance read on which side has been stacking disagreement with price.
🔶 HOW IT WORKS
Pivot scanning: Swing highs and swing lows are confirmed with a symmetric pivot lookback. All divergence checks are evaluated on closed bars at pivot confirmation, so historical signals do not repaint. Confirmation lag equals the right-side pivot length by design.
Confluence evaluation: At each confirmed pivot, every enabled oscillator's value at that pivot is compared against its value at the previous same-side pivot. The four divergence types are tested independently per oscillator, and contributions are counted.
Signal grading: Signals meeting the Minimum Oscillator Confluence print with strength diamonds (one per contributing oscillator). Signals reaching the Strong Signal Threshold upgrade to the accent color and thicker geometry on both the price chart and the composite pane.
Composite rendering: The pane plots the consensus line with a gradient fill to the midline, dashed overbought and oversold guides, tinted extreme bands, triangle marks at divergence bars, and the mirrored divergence lines.
Reaction zones: Each regular divergence projects a box around its pivot sized by Average True Range, extended a configurable number of bars. A bullish zone grays out when price closes below it; a bearish zone grays out when price closes above it.
Dashboard: A fully themeable panel on the price chart shows the last signal, a live divergence pressure meter, and one row per engine with its live value — color-coded for overbought, oversold, or directional state — plus each engine's most recent divergence side. Text size (four steps), position, and every color (title band, background, frame, grid, header, body, muted) are adjustable.
Chart hygiene: The number of divergences kept is capped by input, on both canvases. Older lines, labels, and zones are deleted automatically, keeping the chart readable and the auto-scale anchored to current price.
🔶 HOW TO USE IT
1. Works on any market — cryptocurrency, forex, gold, indices, stocks, futures — and any timeframe. Higher timeframes produce fewer, larger-structure signals.
2. Start with Minimum Oscillator Confluence at 2 and the Strong threshold at 4. Raise the minimum to 3 for a strict, low-frequency reversal tool; lower it to 1 to study single-oscillator behavior.
3. Read the pane and the chart together: a valid signal shows price sloping one way and the composite sloping the other, connected at the same pivots.
4. Regular divergences are reversal-oriented: treat them as exhaustion evidence at swing extremes, strongest when the composite is also inside an overbought or oversold band.
5. Hidden divergences are continuation-oriented: treat them as trend re-entry evidence during pullbacks, and do not read them like reversal signals.
6. Use the reaction zone as the decision area: a live zone holding on retest supports the signal; a grayed zone means the divergence failed.
7. The pressure meter is context, not a trigger — persistent one-sided pressure alongside fresh strong signals is the highest-quality condition.
🔶 SETTINGS
- Pivot Left / Right Length — swing size; larger values scan bigger structures.
- Independent toggles and lengths for all seven oscillator engines.
- Composite pane: normalization lookback, overbought and oversold levels, pane marks, and mirrored divergence lines toggle.
- Regular and hidden divergence toggles, minimum confluence, strong threshold.
- Reaction zone height (Average True Range ratio) and extension.
- Divergences To Keep — caps historical drawings on both canvases for chart cleanliness and stable auto-scale.
- Dashboard with adjustable text size, position, live oscillator values, and full color theming.
- Full color customization for all chart drawings and pivot markers.
🔶 ALERTS
- Bullish Divergence / Bearish Divergence — a regular divergence met the confluence minimum.
- Hidden Bullish Divergence / Hidden Bearish Divergence — a continuation divergence met the minimum.
- Strong Divergence — a regular divergence reached the strong threshold.
🔶 FREQUENTLY ASKED QUESTIONS
Does the indicator repaint? No. Divergences are evaluated only on confirmed pivots at bar close. The trade-off is intentional confirmation lag equal to the right-side pivot length.
Why does a pane divergence line sometimes start slightly off the composite's visual peak? Divergence is measured at price structure points. The line connects the composite's values at the two confirmed price pivots, which is the correct comparison even when the composite made its own extreme a bar or two away.
Why do some obvious divergences not print? Either the confluence minimum was not reached, the oscillator involved is disabled, or the swing did not confirm as a pivot under the current lengths.
Which oscillators should I enable? The default set mixes momentum and volume perspectives, which is the point of confluence: independent evidence, not seven copies of the same math.
Is a Strong signal a guaranteed reversal? No. Strength counts agreement between engines; it is a transparency measure, not a probability of profit.
🔶 CREDITS
This script builds its scanning and composite engine on classic, public-domain oscillators, and gratefully credits their creators: the Relative Strength Index by J. Welles Wilder Jr. (1978), Moving Average Convergence Divergence by Gerald Appel, the Stochastic Oscillator popularized by George C. Lane, the Commodity Channel Index by Donald Lambert (1980), On Balance Volume by Joseph Granville (1963), and the Money Flow Index by Gene Quong and Avrum Soudack. All oscillator calculations use standard built-in formulas. Drawing divergence lines on an oscillator is a long-established charting convention popularized by many community authors, acknowledged here as shared prior art. The multi-engine confluence scanner, the consensus Composite Oscillator, the dual-canvas mirroring, transparency labeling, strength grading, reaction zone life cycle, pressure model, and all code in this script are original work — no third-party or open-source script code was reused.
🔶 LIMITATIONS
Divergence can persist or fail entirely during strong trends; regular divergences against a powerful trend are the weakest application. Volume-based engines (On Balance Volume, Money Flow Index) are less meaningful on symbols with unreliable volume reporting. The composite's normalized components depend on the normalization lookback. Pivot confirmation introduces intentional delay. No indicator replaces independent analysis.
🔶 DISCLAIMER
This script is provided strictly for educational and informational purposes. It is not financial advice, an investment recommendation, or a solicitation to buy or sell any financial instrument. Past behavior of any signal does not guarantee future results. Trading involves substantial risk. Always do your own research and manage risk independently.
====================================================
🔶 OVERVIEW
Multi-Oscillator Divergence Scanner is a confluence-based divergence indicator that scans up to seven classic oscillators simultaneously — Relative Strength Index, Moving Average Convergence Divergence, Stochastic Oscillator, Commodity Channel Index, On Balance Volume, Money Flow Index, and Momentum — and displays the result on two synchronized canvases at once. Divergence lines, graded labels, and reaction zones are drawn directly on the price chart, while a dedicated pane below plots a Composite Oscillator built from every enabled engine, with the same divergence lines mirrored onto the composite itself. You see both slopes of every divergence — price disagreeing with momentum — in one glance.
The problem this script solves is selective divergence trading. Any single oscillator produces frequent divergences, and most of them fail. Requiring multiple mathematically independent engines — momentum-based, volume-based, and volatility-normalized — to diverge at the same confirmed swing filters the noise down to setups where disagreement between price and participation is broad, not incidental.
🔶 WHAT IS A DIVERGENCE?
A divergence occurs when price prints a new extreme but an oscillator refuses to confirm it. A regular bullish divergence forms when price makes a lower low while the oscillator makes a higher low — a classic reversal condition. A regular bearish divergence forms when price makes a higher high while the oscillator makes a lower high. Hidden divergences are the continuation counterparts: price makes a higher low while the oscillator makes a lower low (hidden bullish), or price makes a lower high while the oscillator makes a higher high (hidden bearish). This scanner detects all four types on confirmed swing pivots.
🔶 WHAT IS THE COMPOSITE OSCILLATOR?
The Composite Oscillator is the consensus reading of every engine you enable. Bounded oscillators (Relative Strength Index, Stochastic, Money Flow Index) contribute their native zero-to-one-hundred values; unbounded engines (Moving Average Convergence Divergence histogram, On Balance Volume, Momentum) are range-normalized over a configurable lookback; the Commodity Channel Index is rescaled onto the same axis. The average of all enabled engines plots as a single gradient line with overbought and oversold guides, a midline fill, and divergence lines drawn directly on it — so the pane shows aggregate momentum from the same engines that vote on every signal, not a separate calculation.
🔶 WHY THIS SCRIPT IS ORIGINAL
1. True multi-engine confluence. Divergences are not detected on one oscillator and decorated with others. All seven engines are evaluated independently at every confirmed pivot, and a signal only exists when the minimum confluence count you set is reached.
2. Dual-canvas mirroring. Every qualified divergence is drawn twice: on price, and on the Composite Oscillator in the pane, connected at the same two pivots. Both slopes of the disagreement are visible simultaneously — the visual proof that defines a divergence.
3. Consensus composite pane. The pane line is not one more oscillator; it is the averaged, normalized voice of the exact engines doing the scanning, colored by a gradient between the oversold and overbought guides.
4. Full transparency on every label. Each signal prints its strength as a diamond meter and lists the exact oscillators that diverged (for example: RSI · OBV · MFI). You always know why a signal exists — nothing is a black box.
5. Strength-scaled visuals. Divergence lines thicken with confluence on both canvases, and signals reaching the Strong threshold upgrade to the accent color, so chart hierarchy communicates quality instantly.
6. Reaction zones with a life cycle. Every regular divergence projects a volatility-sized zone around its pivot (measured in Average True Range). Zones gray out automatically the moment price invalidates them, so the chart always distinguishes live zones from dead ones.
7. Divergence pressure gauge. A decaying pressure model accumulates bullish and bearish divergence weight over time, giving a one-glance read on which side has been stacking disagreement with price.
🔶 HOW IT WORKS
Pivot scanning: Swing highs and swing lows are confirmed with a symmetric pivot lookback. All divergence checks are evaluated on closed bars at pivot confirmation, so historical signals do not repaint. Confirmation lag equals the right-side pivot length by design.
Confluence evaluation: At each confirmed pivot, every enabled oscillator's value at that pivot is compared against its value at the previous same-side pivot. The four divergence types are tested independently per oscillator, and contributions are counted.
Signal grading: Signals meeting the Minimum Oscillator Confluence print with strength diamonds (one per contributing oscillator). Signals reaching the Strong Signal Threshold upgrade to the accent color and thicker geometry on both the price chart and the composite pane.
Composite rendering: The pane plots the consensus line with a gradient fill to the midline, dashed overbought and oversold guides, tinted extreme bands, triangle marks at divergence bars, and the mirrored divergence lines.
Reaction zones: Each regular divergence projects a box around its pivot sized by Average True Range, extended a configurable number of bars. A bullish zone grays out when price closes below it; a bearish zone grays out when price closes above it.
Dashboard: A fully themeable panel on the price chart shows the last signal, a live divergence pressure meter, and one row per engine with its live value — color-coded for overbought, oversold, or directional state — plus each engine's most recent divergence side. Text size (four steps), position, and every color (title band, background, frame, grid, header, body, muted) are adjustable.
Chart hygiene: The number of divergences kept is capped by input, on both canvases. Older lines, labels, and zones are deleted automatically, keeping the chart readable and the auto-scale anchored to current price.
🔶 HOW TO USE IT
1. Works on any market — cryptocurrency, forex, gold, indices, stocks, futures — and any timeframe. Higher timeframes produce fewer, larger-structure signals.
2. Start with Minimum Oscillator Confluence at 2 and the Strong threshold at 4. Raise the minimum to 3 for a strict, low-frequency reversal tool; lower it to 1 to study single-oscillator behavior.
3. Read the pane and the chart together: a valid signal shows price sloping one way and the composite sloping the other, connected at the same pivots.
4. Regular divergences are reversal-oriented: treat them as exhaustion evidence at swing extremes, strongest when the composite is also inside an overbought or oversold band.
5. Hidden divergences are continuation-oriented: treat them as trend re-entry evidence during pullbacks, and do not read them like reversal signals.
6. Use the reaction zone as the decision area: a live zone holding on retest supports the signal; a grayed zone means the divergence failed.
7. The pressure meter is context, not a trigger — persistent one-sided pressure alongside fresh strong signals is the highest-quality condition.
🔶 SETTINGS
- Pivot Left / Right Length — swing size; larger values scan bigger structures.
- Independent toggles and lengths for all seven oscillator engines.
- Composite pane: normalization lookback, overbought and oversold levels, pane marks, and mirrored divergence lines toggle.
- Regular and hidden divergence toggles, minimum confluence, strong threshold.
- Reaction zone height (Average True Range ratio) and extension.
- Divergences To Keep — caps historical drawings on both canvases for chart cleanliness and stable auto-scale.
- Dashboard with adjustable text size, position, live oscillator values, and full color theming.
- Full color customization for all chart drawings and pivot markers.
🔶 ALERTS
- Bullish Divergence / Bearish Divergence — a regular divergence met the confluence minimum.
- Hidden Bullish Divergence / Hidden Bearish Divergence — a continuation divergence met the minimum.
- Strong Divergence — a regular divergence reached the strong threshold.
🔶 FREQUENTLY ASKED QUESTIONS
Does the indicator repaint? No. Divergences are evaluated only on confirmed pivots at bar close. The trade-off is intentional confirmation lag equal to the right-side pivot length.
Why does a pane divergence line sometimes start slightly off the composite's visual peak? Divergence is measured at price structure points. The line connects the composite's values at the two confirmed price pivots, which is the correct comparison even when the composite made its own extreme a bar or two away.
Why do some obvious divergences not print? Either the confluence minimum was not reached, the oscillator involved is disabled, or the swing did not confirm as a pivot under the current lengths.
Which oscillators should I enable? The default set mixes momentum and volume perspectives, which is the point of confluence: independent evidence, not seven copies of the same math.
Is a Strong signal a guaranteed reversal? No. Strength counts agreement between engines; it is a transparency measure, not a probability of profit.
🔶 CREDITS
This script builds its scanning and composite engine on classic, public-domain oscillators, and gratefully credits their creators: the Relative Strength Index by J. Welles Wilder Jr. (1978), Moving Average Convergence Divergence by Gerald Appel, the Stochastic Oscillator popularized by George C. Lane, the Commodity Channel Index by Donald Lambert (1980), On Balance Volume by Joseph Granville (1963), and the Money Flow Index by Gene Quong and Avrum Soudack. All oscillator calculations use standard built-in formulas. Drawing divergence lines on an oscillator is a long-established charting convention popularized by many community authors, acknowledged here as shared prior art. The multi-engine confluence scanner, the consensus Composite Oscillator, the dual-canvas mirroring, transparency labeling, strength grading, reaction zone life cycle, pressure model, and all code in this script are original work — no third-party or open-source script code was reused.
🔶 LIMITATIONS
Divergence can persist or fail entirely during strong trends; regular divergences against a powerful trend are the weakest application. Volume-based engines (On Balance Volume, Money Flow Index) are less meaningful on symbols with unreliable volume reporting. The composite's normalized components depend on the normalization lookback. Pivot confirmation introduces intentional delay. No indicator replaces independent analysis.
🔶 DISCLAIMER
This script is provided strictly for educational and informational purposes. It is not financial advice, an investment recommendation, or a solicitation to buy or sell any financial instrument. Past behavior of any signal does not guarantee future results. Trading involves substantial risk. Always do your own research and manage risk independently.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
The institutional Edge: Indicators, Strategies & a Free Academy. quantum-algo.com
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
The institutional Edge: Indicators, Strategies & a Free Academy. quantum-algo.com
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。