OPEN-SOURCE SCRIPT

Divergence Scanner - Multi-Oscillator Confirmation [Dots3Red]

10 022
📉 DIVERGENCE SMART SCANNER — MULTI-OSCILLATOR CONFIRMATION STATS [Dots3Red]
A single-oscillator divergence — price makes a new high while RSI doesn't confirm it — is treated as a reversal warning almost everywhere. Whether adding a second or third oscillator's agreement actually makes that warning more reliable is rarely tested. This script tests it, directly, on the chart in front of you.


WHY THIS MATTERS
"More confirmation means more reliable" is one of the most repeated pieces of trading folklore. This script checks whether that's actually true here, rather than assuming it. Every divergence is checked against three separate oscillators — RSI, MACD histogram, and Williams %R — and graded by how many of them agreed. The outcome of every divergence is then tracked, sorted by that confirmation count:

📊 1 oscillator confirms: 54% reversed (n=28)
📊 2 oscillators confirm: 63% reversed (n=19)
📊 3 oscillators confirm: 71% reversed (n=9)

If confluence genuinely matters on this chart, these numbers should step upward. If they don't, that's useful information too — either way, it's measured, not assumed.


⚙️ HOW IT WORKS
📐 Swing detection — confirmed pivot highs and lows, each stored alongside the value every oscillator held at that exact moment, so structure is compared pivot-to-pivot rather than pivot-to-current-bar.

📊 Multi-oscillator confirmation — a bearish divergence requires price making a higher high; each oscillator that simultaneously makes a *lower* high adds one to the confirmation count. Bullish divergence is the mirror case at swing lows. The count (1, 2, or 3) is shown directly on the chart label.

🎯 Tiered outcome grading — every divergence is tracked forward. If price genuinely moves in the expected reversal direction by a meaningful distance within a set window, it's graded as reversed; otherwise it isn't. The result feeds into that specific confirmation tier's running statistic — 1-oscillator divergences are never mixed together with 3-oscillator ones, since that's exactly the comparison the whole tool exists to make.

🔒 Non-repainting — all detection and grading happens strictly on confirmed bars.


🧭 HOW TO USE
1️⃣ Read the confirmation count on the label before reacting to a divergence. "▼ 1/3 confirm" and "▼ 3/3 confirm" look like the same event on the chart but carry very different weight once you check their respective tiers.

2️⃣ Check the dashboard's tier stats, not just the current divergence. The measured reversal rate and sample size (n=) for that specific tier tell you how much history actually backs it up on this chart.

3️⃣ Let the sample size guide your confidence. A tier with 4-5 recorded events is still forming; one with 30+ is telling you something real about how this instrument has behaved.

4️⃣ Use the tier comparison to decide whether waiting for more confluence is worth it. If reversal rates climb clearly from 1 to 2 to 3 oscillators, holding out for stronger confirmation is justified here. If the tiers are flat or don't separate meaningfully, a single-oscillator divergence is just as informative as a rarer triple-confirmed one — and waiting for 3/3 may just mean missing setups for no real benefit.

5️⃣ Treat it as context, not a trigger. Like every tool in this catalog, it describes what has already happened — it doesn't predict what happens next.


⏱️ WHICH TIMEFRAMES WORK BEST
Divergence needs enough bars between swings to form and then resolve meaningfully, which generally makes 15-minute through 4-hour the most effective range — the same window where most swing-based structure tools perform best.

On very short timeframes (1-3 minute), pivots form so frequently that many flagged divergences will be closer to noise than genuine structure — the tier sample sizes will grow quickly, but individual signals may carry less weight. On daily or weekly charts, genuine divergence setups are naturally rarer, so expect fewer signals and a longer wait before any tier's sample size becomes large enough to trust. The tool still functions on both ends of that range — it simply takes longer, or shorter, for its statistics to become genuinely informative.


🛠️ SETTINGS
📐 Swing Detection — Pivot Leg (bars required on each side to confirm a pivot)

📊 Oscillators — independent length settings for RSI, MACD, and Williams %R

🎯 Outcome Grading — Reversal Confirmation distance (in ATR) and Outcome Window (bars)

🎨 Visualization — toggle divergence lines and confirmation labels independently; line width, line style, label size, and label position style (natural above/below placement, or pointing left)

🎨 Colors — independent bullish/bearish line and label text colors, label background, and full dashboard color control including separate good/bad outcome indicators

🖥️ Dashboard — show/hide, position — all three confirmation tiers with their measured reversal rates and total signal count


📝 NOTES
Statistics accumulate from when the indicator is added to the chart. Higher-confirmation tiers (2 and especially 3 oscillators) will naturally take longer to build a meaningful sample than the 1-oscillator tier, since triple-confirmed divergences are rarer by definition.


⚠️ DISCLAIMER
This is an analytical and visualization tool. It does not generate trade signals and does not constitute financial advice. Historical reversal rates do not guarantee how any future divergence will resolve.

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.