PROTECTED SOURCE SCRIPT

RSI Divergence signal® [BlackRock_et]

21
RSI Divergence signal® [BlackRock_et] — Overview

Overlay indicator that detects regular and hidden RSI divergences and optionally draws price lines between pivot points.
Includes two engines: a Core RSI(5) divergence module with smoothing and a MOST-style module that mirrors the classic “RSI(14) + pivot” logic. Generates Buy/Sell labels and exposes four alert conditions.

How it works

RSI Core (default):

RSI baseline: RSI(5) zero-centered (–50…+50), optional smoothing (SMA/EMA/WMA).

Pivots: price pivots use pivotLeft=7 / pivotRight=1; RSI pivots are synchronized within pivotSyncBars=5.

Regular divergences:

Bullish: price lower low + RSI higher low.

Bearish: price higher high + RSI lower high.

Hidden divergences (optional):

Hidden Bullish: price higher low + RSI lower low.

Hidden Bearish: price lower high + RSI higher high.

On confirmation, the script can draw a dotted/solid price line between the two pivots and place a label at the second pivot.

MOST-style module (optional):

RSI source RSI(14) on close with lookbackLeft=5 / lookbackRight=5.

Signals only when the previous pivot falls within a time gate (5–60 bars).

Detects regular bullish/bearish divergences and plots labels; optional price lines between the two swing points.

Plots & labels (what you see)

Buy/Sell labels: “B” for bullish, “S” for bearish; hidden divergences add “(H)”.

Optional price lines between the two price pivots (toggleable).

Colors for regular/hidden bull/bear and label styles are user-configurable.

Inputs (user controls)

Show Regular Divergence (Core) — on/off

Show Hidden Divergence (Core) — on/off

Use MOST-style Divergence — on/off

Draw Price Lines — draw/remove lines between pivots

Delete Broken Lines — when new lines overlap older ones, delete older lines instead of downgrading them to dotted

Colors — bull/bear (regular & hidden) and label BG/text colors

Core engine lengths, pivot distances, smoothing and MOST params are locked in code for consistency across users.

Alerts

Four ready-to-use alertconditions:

Buy (Bullish Divergence — Core)

Sell (Bearish Divergence — Core)

Buy (Bullish Divergence — MOST)

Sell (Bearish Divergence — MOST)

Usage notes

Timeframes/markets: Works on any symbol/timeframe; for cleaner pivots, consider H1+ on volatile markets (crypto/FX/indices/equities).

Confirmation timing: Signals appear after pivot confirmation (pivotRight=1) and are evaluated on bar close.

Lines & clutter: If your chart becomes busy, either disable Draw Price Lines or enable Delete Broken Lines.

Chart types: Designed for standard candles; alternative chart types (Heikin Ashi, Renko, Range, etc.) can distort divergence logic.

Not auto-trading: Labels/alerts are contextual indications, not standalone entries. Always confirm with your own rules and risk control.

Limitations

Pivot dependency: Divergences rely on swing identification; changing timeframe or extreme volatility may shift which pivots qualify.

No MTF sources: Signals are computed on the chart’s timeframe; there is no request.security() MTF in this script.

Label/line caps: Internally manages arrays and respects max_lines_count / max_labels_count; excessive history may be trimmed.

Release notes

v1.0 (2025-09-10): Initial public release with Core (regular/hidden) and optional MOST-style divergences, price-line drawing, and four alertconditions.

כתב ויתור

המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.