Indicator · Pine Script v6 · Own pane

Whales + RSI/ADX/DMI

by idrode

Calculates and plots a multi-component indicator in a separate pane, integrating Relative Strength Index (RSI), Average Directional Index (ADX), Directional Movement Index (DMI), and price Bollinger Bands.

View on GitHub

GitHub stars10on the repository
Pine versionv6current
Lines of code131
Settings25inputs
LicenceAGPL-3.0
Last update5 weeks ago17 Sep 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

131 lines of Pine Script v6 from reference/whales_rsi_adx_dmi.pine, published under AGPL-3.0. Keep the author's credit and licence lines when you reuse it.

whales_rsi_adx_dmi.pine
//@version=6
indicator("Whales + RSI/ADX/DMI", shorttitle="whales+RSI", overlay=false)

// ═══════════════════════════════════════════════
// GRUPOS DE PARÁMETROS
// ═══════════════════════════════════════════════
gRSI   = "RSI"
gDMI   = "ADX y DMI"
gMOD   = "RSI Modificado (%B)"
gWHALE = "Ballenas (Whales)"

// ── RSI (compartido por el display y por las señales de ballena) ──
rsiLengthInput  = input.int(14, minval=1, title="RSI: Longitud", group=gRSI)
rsiSourceInput  = input.source(close, "RSI: Fuente", group=gRSI)
maTypeInput     = input.string("SMA", title="Tipo de MA", options=["SMA","Bollinger Bands","EMA","SMMA (RMA)","WMA","VWMA"], group=gRSI)
maLengthInput   = input.int(14, title="Longitud MA", group=gRSI)
bbMultInput     = input.float(2.0, minval=0.001, maxval=50, title="Desv. Estándar BB (sobre RSI)", group=gRSI)
overBoughtLevel = input.int(70, "Nivel Sobrecompra", minval=50, maxval=100, group=gRSI)
overSoldLevel   = input.int(30, "Nivel Sobreventa",  minval=0,  maxval=50,  group=gRSI)

// ── ADX y DMI (compartido) ──
adxlen = input.int(14, title="ADX Smoothing", group=gDMI)
dilen  = input.int(14, title="DI Length",     group=gDMI)

// ── RSI Modificado (%B) ──
mavLength = input.int(20, title="Longitud",      group=gMOD)
mavSrc    = input.source(close, title="Fuente",  group=gMOD)
mavMult   = input.float(2.0, title="Multiplicador", group=gMOD)

// ── Ballenas: Bollinger de PRECIO + umbrales ──
bb_len     = input.int(20, "BB Precio: Período", minval=5, group=gWHALE)
bb_mult    = input.float(2.0, "BB Precio: Desviación", minval=0.5, step=0.1, group=gWHALE)
whaleScale = input.float(10.0, "Intensidad ×", minval=1, step=1, group=gWHALE, tooltip="Multiplica la altura de las columnas de ballena para que sean visibles en el panel 0-100. Sube/baja según la volatilidad del activo.")
whaleCap   = input.float(95.0, "Altura máxima columnas", minval=10, maxval=100, group=gWHALE)
showMarks  = input.bool(true, "Mostrar marcas ▲▼", group=gWHALE)

// Long (ballena comprando)
rsi_max = input.float(40.0, "RSI máx (long)", minval=10, step=1.0, group=gWHALE)
adx_max = input.float(28.0, "ADX máx (long)", minval=10, step=1.0, group=gWHALE)
pdi_max = input.float(20.0, "+DI máx (long)", minval=5,  step=1.0, group=gWHALE)
mdi_min = input.float(23.0, "-DI mín (long)", minval=10, step=1.0, group=gWHALE)
// Short (ballena vendiendo)
rsi_min   = input.float(60.0, "RSI mín (short)", minval=10, step=1.0, group=gWHALE)
adx_max_s = input.float(28.0, "ADX máx (short)", minval=10, step=1.0, group=gWHALE)
pdi_min_s = input.float(23.0, "+DI mín (short)", minval=5,  step=1.0, group=gWHALE)
mdi_max_s = input.float(20.0, "-DI máx (short)", minval=5,  step=1.0, group=gWHALE)

// ═══════════════════════════════════════════════
// CÁLCULOS
// ═══════════════════════════════════════════════

// ── RSI clásico (manual: habilita MA y BB sobre el propio RSI) ──
change = ta.change(rsiSourceInput)
up     = ta.rma(math.max(change, 0), rsiLengthInput)
down   = ta.rma(-math.min(change, 0), rsiLengthInput)
rsi    = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
rsiMA  = switch maTypeInput
    "SMA"        => ta.sma(rsi, maLengthInput)
    "EMA"        => ta.ema(rsi, maLengthInput)
    "SMMA (RMA)" => ta.rma(rsi, maLengthInput)
    "WMA"        => ta.wma(rsi, maLengthInput)
    "VWMA"       => ta.vwma(rsi, maLengthInput)
    => na
stdDev  = bbMultInput * ta.stdev(rsi, maLengthInput)
bbUpper = maTypeInput == "Bollinger Bands" ? rsiMA + stdDev : na
bbLower = maTypeInput == "Bollinger Bands" ? rsiMA - stdDev : na

// ── RSI Modificado (%B) ──
basis = ta.sma(mavSrc, mavLength)
dev   = mavMult * ta.stdev(mavSrc, mavLength)
upper = basis + dev
lower = basis - dev
b_percent        = (mavSrc - lower) / (upper - lower) * 100
scaled_b_percent = b_percent * 0.5 + 25   // reescalado visual al rango ~25-75

// ── ADX y DMI (built-in, compartido por display y ballenas) ──
[plusDI, minusDI, adxVal] = ta.dmi(dilen, adxlen)

// ── Bollinger de PRECIO (solo para las condiciones de ballena, NO se plotea) ──
[bb_mid, price_bb_upper, price_bb_lower] = ta.bb(close, bb_len, bb_mult)

// ═══════════════════════════════════════════════
// CONDICIONES DE BALLENA
// ═══════════════════════════════════════════════
signal_long  = low  <= price_bb_lower and rsi < rsi_max   and plusDI < pdi_max  and minusDI > mdi_min  and adxVal < adx_max
signal_short = high >= price_bb_upper and rsi > rsi_min   and plusDI > pdi_min_s and minusDI < mdi_max_s and adxVal < adx_max_s

// Intensidad = distancia % fuera de la banda
dist_long  = signal_long  ? math.max(price_bb_lower - close, 0) / price_bb_lower * 100 : 0
dist_short = signal_short ? math.max(close - price_bb_upper, 0) / price_bb_upper * 100 : 0

// Altura reescalada al panel 0-100 (columnas desde 0; long/short son mutuamente excluyentes)
whale_buy  = signal_long  ? math.min(math.max(dist_long,  0.1) * whaleScale, whaleCap) : na
whale_sell = signal_short ? math.min(math.max(dist_short, 0.1) * whaleScale, whaleCap) : na

// ═══════════════════════════════════════════════
// VISUALIZACIÓN
// ═══════════════════════════════════════════════

// Columnas de ballena (semitransparentes para no tapar las líneas)
plot(whale_buy,  title="Ballena Comprando", style=plot.style_columns, color=color.new(#00E676, 55))
plot(whale_sell, title="Ballena Vendiendo", style=plot.style_columns, color=color.new(#FF1744, 55))

// Marcas que indican el lado: ▲ compra abajo, ▼ venta arriba
plotshape(showMarks and signal_long  ? 3  : na, title="▲ Compra ballena", style=shape.triangleup,   location=location.absolute, color=color.new(#00E676, 0), size=size.tiny)
plotshape(showMarks and signal_short ? 97 : na, title="▼ Venta ballena",  style=shape.triangledown, location=location.absolute, color=color.new(#FF1744, 0), size=size.tiny)

// Fondo sobrecompra/sobreventa (RSI clásico)
bgcolor(rsi > overBoughtLevel ? color.new(color.red, 92)   : na, title="Área Sobrecompra")
bgcolor(rsi < overSoldLevel   ? color.new(color.green, 92) : na, title="Área Sobreventa")

// RSI clásico + MA + BB sobre el RSI
rsiColor = rsi > overBoughtLevel ? color.new(color.red, 0) : rsi < overSoldLevel ? color.new(color.green, 0) : color.new(#7E57C2, 0)
plot(rsi,   "RSI Clásico", color=rsiColor, linewidth=2)
plot(rsiMA, "MA del RSI",  color=color.new(color.yellow, 0))
p_bbU = plot(bbUpper, "BB Superior (RSI)", color=color.new(color.green, 50))
p_bbL = plot(bbLower, "BB Inferior (RSI)", color=color.new(color.green, 50))
fill(p_bbU, p_bbL, color=color.new(color.green, 90))

// RSI Modificado (%B escalado)
plot(scaled_b_percent, "RSI Modificado (%B)", color=color.new(color.blue, 0), linewidth=2)

// ADX y DMI
plot(adxVal,  "ADX", color=color.new(color.red, 0),  linewidth=1)
plot(plusDI,  "+DI", color=color.new(#2962FF, 0),    linewidth=1)
plot(minusDI, "-DI", color=color.new(#FF6D00, 0),    linewidth=1)

// Niveles de referencia
hline(overBoughtLevel, "Sobrecompra", color=color.new(color.red, 50))
hline(overSoldLevel,   "Sobreventa",  color=color.new(color.green, 50))
hline(50, "Media", color=color.new(color.gray, 50), linestyle=hline.style_dotted)

Overview

Whales + RSI/ADX/DMI detects institutional movement conditions by testing combined threshold criteria across RSI, ADX, and directional indicators. When conditions trigger, it displays scaled visual columns and optional buy/sell marks. Key settings control indicator periods, moving average types, and detection thresholds.

Details

Published by

idrode on GitHub

Type

Indicator, Pine Script v6

Draws

Separate pane below the chart

Category

Oscillators & momentum, Volatility & bands

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
RSI: Longitudint14rsiLengthInput
RSI: FuentesourceclosersiSourceInput
Tipo de MAstringSMAmaTypeInput
Longitud MAint14maLengthInput
Desv. Estándar BB (sobre RSI)float2.0bbMultInput
Nivel Sobrecompraint70overBoughtLevel
Nivel Sobreventaint30overSoldLevel
ADX Smoothingint14adxlen
DI Lengthint14dilen
Longitudint20mavLength
FuentesourceclosemavSrc
Multiplicadorfloat2.0mavMult
Show all 25 settings
SettingTypeDefaultVariable
BB Precio: Períodoint20bb_len
BB Precio: Desviaciónfloat2.0bb_mult
Intensidad ×float10.0whaleScale
Altura máxima columnasfloat95.0whaleCap
Mostrar marcas ▲▼booltrueshowMarks
RSI máx (long)float40.0rsi_max
ADX máx (long)float28.0adx_max
+DI máx (long)float20.0pdi_max
-DI mín (long)float23.0mdi_min
RSI mín (short)float60.0rsi_min
ADX máx (short)float28.0adx_max_s
+DI mín (short)float23.0pdi_min_s
-DI máx (short)float20.0mdi_max_s
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

TTM Squeeze

by Alorse
330 stars

This indicator plots a TTM Squeeze momentum oscillator in a separate pane. It compares a Bollinger Band offset to a Keltner Channel offset and marks the zero line white when the difference is non-negative and black when the bands are inside the channel. A line

Indicator v5 Oscillators & momentumVolatility & bands
Updated 2 months ago · None stated GitHub repository of TTM Squeeze

Function - Logistic Equation

by ricardosantos79
261 stars

Calculates dynamic modeling values by applying a mathematical logistic differential equation to price change over a specified lookback length. It measures price momentum relative to the recent high-low price range. The script plots positive and negative logist

Indicator v5 Oscillators & momentumVolatility & bands
Updated 4 years ago · None stated GitHub repository of Function - Logistic Equation

MACD-V

by harryguiacorn
219 stars

MACD-V is a volatility-normalized momentum indicator based on research by Alex Spiroglou. It calculates the standard MACD histogram and normalizes it by dividing by the Average True Range (ATR). Plotted in a separate pane as a colored histogram, it includes us

Indicator v5 Oscillators & momentumVolatility & bands
Updated 1 year ago · None stated GitHub repository of MACD-V
218 stars

This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Bollinger Band Squeeze Detector
147 stars

This indicator generates trade entry signals and target levels optimized for 1-hour timeframes, designed for external signal extraction. It calculates 7-period and 16-period EMAs alongside 10-period RSI and ATR filters. Long signals occur when the fast EMA cro

Indicator v5 TrendOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of Signal Strategy 100 Candles of 1H Timeframe

Bubbles Indicator

by capissimo
114 stars

The Bubbles Indicator measures volatility squeezes and expansion bursts using Bollinger Bands combined with a sinusoid oscillator and RSI divergence. It processes price data through scaled Bollinger Bands to highlight volatility changes while confirming trend

Indicator v4 Volatility & bandsOscillators & momentum Repaints
Updated 1 year ago · None stated GitHub repository of Bubbles Indicator

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers