PROTECTED SOURCE SCRIPT
Whale Reversal Hunter

//version=5
indicator(title="Whale Reversal Hunter", shorttitle="Whale Hunter", overlay=true)
// --- INPUTS ---
// SMA settings
fast_sma_len = input.int(20, title="Fast SMA Length")
slow_sma_len = input.int(50, title="Slow SMA Length")
// RSI settings for divergence
rsi_len = input.int(14, title="RSI Length")
// Demand/Supply Zone settings
demand_zone_volume_multiplier = input.float(1.5, title="Demand/Supply Zone Volume Multiplier", step=0.1)
// --- CALCULATIONS ---
// Calculate SMAs
fast_sma = ta.sma(close, fast_sma_len)
slow_sma = ta.sma(close, slow_sma_len)
// Calculate RSI
rsi_val = ta.rsi(close, rsi_len)
// --- HIDDEN DIVERGENCE LOGIC ---
// Bullish hidden divergence: price makes a higher low, but RSI makes a lower low.
bullish_div = ta.lowest(low, 2)[1] > ta.lowest(low, 2) and rsi_val[1] > rsi_val
// Bearish hidden divergence: price makes a lower high, but RSI makes a higher high.
bearish_div = ta.highest(high, 2)[1] < ta.highest(high, 2) and rsi_val[1] < rsi_val
// --- DEMAND/SUPPLY ZONE DETECTION ---
// Identify strong demand candles (large body, high volume)
is_demand_candle = (close > open) and (close - open) > (high - low) * 0.5 and (volume > ta.ema(volume, 50) * demand_zone_volume_multiplier)
// Identify strong supply candles (large body, high volume)
is_supply_candle = (open > close) and (open - close) > (high - low) * 0.5 and (volume > ta.ema(volume, 50) * demand_zone_volume_multiplier)
// Store the most recent demand/supply zone prices and lines
var float last_demand_zone_price = na
var line last_demand_line = na
var float last_supply_zone_price = na
var line last_supply_line = na
// Update demand zone
if is_demand_candle
last_demand_zone_price := low
if not na(last_demand_line)
line.delete(last_demand_line)
last_demand_line := line.new(bar_index, low, bar_index, low, color=color.new(color.green, 0), style=line.style_solid, width=2, extend=extend.right)
// Update supply zone
if is_supply_candle
last_supply_zone_price := high
if not na(last_supply_line)
line.delete(last_supply_line)
last_supply_line := line.new(bar_index, high, bar_index, high, color=color.new(color.red, 0), style=line.style_solid, width=2, extend=extend.right)
// --- SIGNAL LOGIC ---
// Check if current price is near a demand or supply zone
is_in_demand_zone = not na(last_demand_zone_price) and (math.abs(close - last_demand_zone_price) / last_demand_zone_price) < 0.005
is_in_supply_zone = not na(last_supply_zone_price) and (math.abs(close - last_supply_zone_price) / last_supply_zone_price) < 0.005
// Bullish signal:
// 1. Bullish hidden divergence is true.
// 2. Price is near a demand zone.
// 3. Fast SMA is crossing above the Slow SMA.
bullish_signal = bullish_div and is_in_demand_zone and ta.crossover(fast_sma, slow_sma)
// Bearish signal:
// 1. Bearish hidden divergence is true.
// 2. Price is near a supply zone.
// 3. Fast SMA is crossing below the Slow SMA.
bearish_signal = bearish_div and is_in_supply_zone and ta.crossunder(fast_sma, slow_sma)
// --- PLOTS & VISUALS ---
// Plot SMAs on the chart
plot(fast_sma, title="Fast SMA", color=color.new(color.blue, 0), linewidth=2)
plot(slow_sma, title="Slow SMA", color=color.new(color.orange, 0), linewidth=2)
// Plot buy/sell signals on the chart
plotshape(bullish_signal, title="Buy Signal", location=location.belowbar, style=shape.triangleup, size=size.small, color=color.new(color.green, 0))
plotshape(bearish_signal, title="Sell Signal", location=location.abovebar, style=shape.triangledown, size=size.small, color=color.new(color.red, 0))
// Alert conditions
alertcondition(bullish_signal, title="Buy Signal", message="Whale Reversal Hunter: Potential BUY signal detected.")
alertcondition(bearish_signal, title="Sell Signal", message="Whale Reversal Hunter: Potential SELL signal detected.")
// --- FOOTNOTE ---
// This indicator is a conceptual tool for educational purposes only and not financial advice.
// Past performance is not indicative of future results.
indicator(title="Whale Reversal Hunter", shorttitle="Whale Hunter", overlay=true)
// --- INPUTS ---
// SMA settings
fast_sma_len = input.int(20, title="Fast SMA Length")
slow_sma_len = input.int(50, title="Slow SMA Length")
// RSI settings for divergence
rsi_len = input.int(14, title="RSI Length")
// Demand/Supply Zone settings
demand_zone_volume_multiplier = input.float(1.5, title="Demand/Supply Zone Volume Multiplier", step=0.1)
// --- CALCULATIONS ---
// Calculate SMAs
fast_sma = ta.sma(close, fast_sma_len)
slow_sma = ta.sma(close, slow_sma_len)
// Calculate RSI
rsi_val = ta.rsi(close, rsi_len)
// --- HIDDEN DIVERGENCE LOGIC ---
// Bullish hidden divergence: price makes a higher low, but RSI makes a lower low.
bullish_div = ta.lowest(low, 2)[1] > ta.lowest(low, 2) and rsi_val[1] > rsi_val
// Bearish hidden divergence: price makes a lower high, but RSI makes a higher high.
bearish_div = ta.highest(high, 2)[1] < ta.highest(high, 2) and rsi_val[1] < rsi_val
// --- DEMAND/SUPPLY ZONE DETECTION ---
// Identify strong demand candles (large body, high volume)
is_demand_candle = (close > open) and (close - open) > (high - low) * 0.5 and (volume > ta.ema(volume, 50) * demand_zone_volume_multiplier)
// Identify strong supply candles (large body, high volume)
is_supply_candle = (open > close) and (open - close) > (high - low) * 0.5 and (volume > ta.ema(volume, 50) * demand_zone_volume_multiplier)
// Store the most recent demand/supply zone prices and lines
var float last_demand_zone_price = na
var line last_demand_line = na
var float last_supply_zone_price = na
var line last_supply_line = na
// Update demand zone
if is_demand_candle
last_demand_zone_price := low
if not na(last_demand_line)
line.delete(last_demand_line)
last_demand_line := line.new(bar_index, low, bar_index, low, color=color.new(color.green, 0), style=line.style_solid, width=2, extend=extend.right)
// Update supply zone
if is_supply_candle
last_supply_zone_price := high
if not na(last_supply_line)
line.delete(last_supply_line)
last_supply_line := line.new(bar_index, high, bar_index, high, color=color.new(color.red, 0), style=line.style_solid, width=2, extend=extend.right)
// --- SIGNAL LOGIC ---
// Check if current price is near a demand or supply zone
is_in_demand_zone = not na(last_demand_zone_price) and (math.abs(close - last_demand_zone_price) / last_demand_zone_price) < 0.005
is_in_supply_zone = not na(last_supply_zone_price) and (math.abs(close - last_supply_zone_price) / last_supply_zone_price) < 0.005
// Bullish signal:
// 1. Bullish hidden divergence is true.
// 2. Price is near a demand zone.
// 3. Fast SMA is crossing above the Slow SMA.
bullish_signal = bullish_div and is_in_demand_zone and ta.crossover(fast_sma, slow_sma)
// Bearish signal:
// 1. Bearish hidden divergence is true.
// 2. Price is near a supply zone.
// 3. Fast SMA is crossing below the Slow SMA.
bearish_signal = bearish_div and is_in_supply_zone and ta.crossunder(fast_sma, slow_sma)
// --- PLOTS & VISUALS ---
// Plot SMAs on the chart
plot(fast_sma, title="Fast SMA", color=color.new(color.blue, 0), linewidth=2)
plot(slow_sma, title="Slow SMA", color=color.new(color.orange, 0), linewidth=2)
// Plot buy/sell signals on the chart
plotshape(bullish_signal, title="Buy Signal", location=location.belowbar, style=shape.triangleup, size=size.small, color=color.new(color.green, 0))
plotshape(bearish_signal, title="Sell Signal", location=location.abovebar, style=shape.triangledown, size=size.small, color=color.new(color.red, 0))
// Alert conditions
alertcondition(bullish_signal, title="Buy Signal", message="Whale Reversal Hunter: Potential BUY signal detected.")
alertcondition(bearish_signal, title="Sell Signal", message="Whale Reversal Hunter: Potential SELL signal detected.")
// --- FOOTNOTE ---
// This indicator is a conceptual tool for educational purposes only and not financial advice.
// Past performance is not indicative of future results.
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 無料かつ制限なしでご利用いただけます ― 詳細についてはこちらをご覧ください。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。
保護スクリプト
このスクリプトのソースコードは非公開で投稿されています。 無料かつ制限なしでご利用いただけます ― 詳細についてはこちらをご覧ください。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。