OPEN-SOURCE SCRIPT
Leviathan Protocol - Institutional Liquidity & Sweep Sniper

Description:
The Leviathan Protocol is a comprehensive technical analysis tool designed to track institutional liquidity pools, momentum exhaustion (RSI Divergences), and Support/Resistance Flips (Retests).
Most retail traders fall victim to fakeouts by trading raw breakouts. This indicator was built to filter out market noise and identify the precise moments when "Smart Money" captures liquidity to reverse the market.
HOW THE MATH & LOGIC WORKS:
1. Liquidity Zones (Pivots): The script calculates ta.pivothigh and ta.pivotlow based on a 29-period swing to identify major pools of stop-losses. It plots these as dotted Red (Resistance) and Green (Support) lines.
2. Liquidity Sweeps & Divergence: When the price pierces a liquidity line but closes back inside (leaving a wick), it triggers a Sweep. The script then cross-references this action with a 14-period RSI. If a Top Sweep occurs alongside a lower RSI high, it plots a BEAR DIV label. If a Bottom Sweep occurs with a higher RSI low, it plots a BULL DIV label.
3. S/R Flip Retest (Sniper Mode): When a major liquidity line is completely broken by a candle close, the script saves this level in memory using var variables. If the price returns to test this broken support (now resistance) and gets rejected, it plots an Orange Cross (RETEST SHORT). Vice versa for Longs (RETEST LONG).
4. Predictive EMA 200: Plots a 200 EMA and calculates its angular inertia over the last 5 bars to project a dashed line 30 candles into the future, helping to estimate dynamic support/resistance collisions.
FEATURES & SETTINGS:
* Toggle "Ignore GAP Signals" to prevent false divergence readings in traditional markets (Stocks/Forex) where overnight gaps occur.
Disclaimer: This indicator is for educational and analytical purposes only. It does not constitute financial advice. Always combine these signals with Order Flow analysis (e.g., Spot CVD) and proper risk management.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
🔱 LeviatanSignals® — automação de fluxo institucional (SMC) para Binance e MEXC Futures. Vídeos, app e mais: leviatansignals.com.br/
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
🔱 LeviatanSignals® — automação de fluxo institucional (SMC) para Binance e MEXC Futures. Vídeos, app e mais: leviatansignals.com.br/
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.