Smart Divergence Engine
Smart Divergence Engine — User Guide (Panel)
What it is (one-liner)
A momentum panel that finds clean RSI divergences and a high-energy reversal tell called the Shark Fin—so you can spot exhaustion early and time entries with structure.
Quick Start (TL;DR)
Add the indicator to any chart/timeframe.
Look for:
Bullish Divergence (RSI rising while price makes a lower low) near or below the Oversold line → potential long.
Bearish Divergence (RSI falling while price makes a higher high) near or above Overbought → potential short.
Shark Fin fill outside the bands that re-enters → momentum snapback often starts here.
Wait for confirmation: signals appear only after a pivot is confirmed, which takes a few bars by design.
Use alerts: “Bullish/Bearish Divergence (Panel)” and “RSI Shark Fin — Bullish/Bearish”.

How it works:
RSI core: Uses a classic RSI (default 14) with a gentle smoothing for a cleaner “price line.”
Volatility bands: Around that RSI line we draw bands based on a moving average (default 34) and standard deviation (multiplier 1.618). Think of them like Bollinger-style rails for momentum.
Shark Fin:
When RSI pushes beyond the outer band by a small buffer, a fin “forms” (soft green fill below or red fill above).
When RSI re-enters the band with healthy slope and enough volatility, a fin confirm triggers (this is the actionable part).
There’s a built-in cooldown so you don’t get spammed.
Divergences:
We detect confirmed swing highs/lows (pivots) on price.
At each new confirmed pivot we compare price vs. RSI at that same pivot bar.
If price makes a lower low but RSI makes a higher low → Bullish divergence. If price makes a higher high but RSI makes a lower high → Bearish divergence.
You’ll see a clean connector line + a tiny dot and a label (“Bull” or “Bear”).
Why your signal appears “late”: a pivot isn’t known until R bars have passed on the right side of the swing. That’s intentional—so you get confirmed structure, not guesses.
Reading the panel
OB/OS levels: Defaults 68/32, with a dotted 50 midline.
Gradient “Beauty Mode” (optional): Purple above 50, green below 50—purely visual to help you see slope and distance from neutral at a glance.
Bands (optional): Show/hide the volatility bands if you prefer a cleaner panel.
Inputs (explained)
Core
Price Source: Default
close.RSI Length: Default 14. Higher = smoother, fewer signals.
Volatility Band Length: Default 34 (MA window for bands).
Band Multiplier: Default 1.618 (wider → fewer fins; tighter → more fins).
Overbought / Oversold: Defaults 68/32. Adjust for your market’s personality.
Pivot Left / Right: Defaults 10/10. Bigger numbers = more reliable, slower confirmations.
Style
Beauty mode: On/off for gradient fill around 50.
Glow on divergence lines: Adds a soft halo; Glow width and Main line width are adjustable.
Top/Bottom colors & opacities: Tweak the gradient palette to taste.
Shark Fin
Fin depth buffer (RSI pts): How far past the band the RSI must go to count as a fin.
Min band stdev (vol filter): Require enough volatility to avoid weak pops.
Min bars between fins: Built-in cooldown for cleaner signals.
Show Volatility Bands: Toggle the outer rails.
Alerts (ready to use)
RSI Shark Fin — Bullish
RSI Shark Fin — Bearish
Bullish Divergence (Panel)
Bearish Divergence (Panel)
Setup: TradingView → Alerts → “Condition: Smart Divergence Engine” → pick one of the four alertconditions. Choose Once/Every time as you prefer.
Playbook (how to trade it)
A) Divergence Reversal
Context: After a strong move into OB/OS or into HTF support/resistance.
Trigger: A Bull (or Bear) divergence label + line prints.
Entry: Conservative—wait for the next candle to confirm structure in your direction. Aggressive—enter on the signal bar close.
Invalidation: The pivot price that defined the divergence.
Targets: First to midline (50), then to the opposite band or recent structure.
B) Shark-Fin Snapback
Context: RSI “sticks out” beyond the band (fin forming), then re-enters with slope backing the reversal.
Entry: On fin confirm (alert) or on the bar close that re-enters.
Invalidation: Recent swing extreme or the low/high of the fin excursion.
Targets: Band mid / structure; scale out on the first stall.
C) Stack the Edges (best-of-best)
Combine:
Divergence at structure,
Shark Fin re-entry, and
Market confluence (HTF level, liquidity sweep, session timing). These stacked setups tend to be your A-grade trades.
Timeframes & presets
Scalp
1–5m
5 / 5
Faster confirmations, more signals. Consider a slightly tighter Band Multiplier (e.g., 1.4–1.5).
Day trade
5–15m
8–10 / 8–10
Balanced reliability vs. speed (defaults are great here).
Swing
1h–4h
12–20 / 12–20
Fewer but stronger signals; widen stops to structure not ATR alone.
Tip: If you get too many divergence lines, increase Pivot L/R. If you get too few, decrease them or ease the fin filters.
Risk management (must-do)
Place your stop beyond the pivot extreme that defined the signal.
Size positions so that a single failed divergence is just a small account dent.
Scale out on clear inflection zones (50 line, opposite band, prior S/R).
Avoid chasing in news spikes—fins can appear frequently when volatility is abnormal.
Common questions
Q: Why didn’t I get a divergence where I “see” one? A: The engine only prints after a confirmed pivot and requires the RSI comparison at that same pivot bar. If the structure isn’t confirmed yet, it won’t draw.
Q: Can the fin fill show without a confirm? A: Yes. A fin forms when RSI is outside the bands; it confirms only on re-entry with slope/volatility and cooldown rules.
Q: The lines look thick/bright. A: Turn Glow off or reduce Glow width / Main line width in Style.
Q: The panel looks different across symbols. A: Markets have different volatility. If fins feel rare, lower Min band stdev or Fin depth buffer a touch. If they’re too frequent, raise them.
Advanced notes (for power users)
Confirmation timing: Signals require R right bars; the pivot’s RSI value is taken at that pivot bar, not later.
Band logic: Bands are MA±σ·k around smoothed RSI; you can turn them off if you only want divergences & fins.
Lookback: The script is optimized for up to 500 bars on load for stability and speed.
Best practices & pairing
Use this panel together with the Smart Divergence Engine Overlay (price-chart lines & labels using the same logic). The panel times momentum; the overlay nails the candle anchors and risk levels.
Add HTF context (draw key S/R) and a session bias (London/NY).
Keep the chart clean; signals are designed to be minimal and readable.
Troubleshooting
No signals for a while → Lower Pivot L/R or ease fin filters; check you’re on a sufficiently volatile symbol/timeframe.
Too many signals → Increase Pivot L/R, raise Min band stdev, or widen Fin depth buffer.
Visual clutter → Turn off Bands or Glow, keep gradient on for readability.
Changelog info (what you’re using)
Version: Smart Divergence Engine V1 (Panel)
Defaults: RSI 14, Bands 34 × 1.618, OB/OS 68/32, Pivot 10/10, gradient on, bands on, divergence lines with optional glow.
Final word
Use SDE as your reversal radar—let it confirm structure, then execute with discipline. The edge appears often; the win-rate comes from selection and risk control.
Last updated