Indicator · Pine Script v6 · On the chart

Leviathan Protocol Ultimate Sniper

by theonetrade

Leviathan Protocol Ultimate Sniper is an overlay indicator that identifies institutional liquidity sweeps, RSI divergences, and support/resistance flip retests.

View on GitHub

GitHub stars34on the repository
Pine versionv6current
Lines of code114
Settings7inputs
LicenceMIT
Last update2 weeks ago8 Nov 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

114 lines of Pine Script v6 from assets/indicator/bit-exact/leviathan_protocol_institutional_liquidity_sweep_sniper_ztHPkWXF.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

leviathan_protocol_institutional_liquidity_sweep_sniper_ztHPkWXF.pine
//@version=6
indicator("Leviathan Protocol [Ultimate Sniper]", overlay=true, max_lines_count=100)

// ==========================================
// 1. GENERAL SETTINGS
// ==========================================
length = input.int(29, "Liquidity Period (Swing)", minval=3)
rsiLen = input.int(14, "RSI Period")

grp_ema = "EMA 200 Settings"
emaLen = input.int(200, "Main EMA Period", group=grp_ema)
futuro = input.int(30, "EMA Future Projection (Candles)", group=grp_ema)
suavizacao = input.int(5, "Inertia Smoothing", group=grp_ema)

grp_filtros = "Visual Filters"
ignorarGaps = input.bool(true, "Ignore GAP Signals (Stocks/Forex)", group=grp_filtros)
mostrarSimples = input.bool(false, "Show Simple Sweeps (No Divergence)", group=grp_filtros)

// ==========================================
// 2. EMA 200 & LASER PROJECTION
// ==========================================
ema200 = ta.ema(close, emaLen)
plot(ema200, color=color.yellow, linewidth=2, title="Real EMA 200")

velocidade = (ema200 - ema200[suavizacao]) / suavizacao
var line linhaProjecao = na

if barstate.islast
    line.delete(linhaProjecao)
    y_futuro = ema200 + (velocidade * futuro)
    linhaProjecao := line.new(x1=bar_index, y1=ema200, x2=bar_index + futuro, y2=y_futuro, color=color.new(color.yellow, 40), width=2, style=line.style_dashed)

// ==========================================
// 3. RSI & DIVERGENCES
// ==========================================
rsi = ta.rsi(close, rsiLen)

// ==========================================
// 4. LIQUIDITY LOGIC & PIVOTS
// ==========================================
ph = ta.pivothigh(high, length, length)
pl = ta.pivotlow(low, length, length)

var float topLiquidity = na
var float bottomLiquidity = na
var float topRsi = na
var float botRsi = na

// Sniper Memory (S/R Flip Retest)
var float brokenSupport = na
var float brokenResistance = na

// Update Main Highs and Lows
if not na(ph)
    topLiquidity := high[length]
    topRsi := rsi[length]
if not na(pl)
    bottomLiquidity := low[length]
    botRsi := rsi[length]

plot(topLiquidity, title="Top Liquidity", color=color.new(color.red, 30), linewidth=2, style=plot.style_circles, offset=-length)
plot(bottomLiquidity, title="Bottom Liquidity", color=color.new(color.green, 30), linewidth=2, style=plot.style_circles, offset=-length)

// ==========================================
// 5. BREAKOUT DETECTORS (CRIME SCENE)
// ==========================================
if (close < bottomLiquidity and close[1] >= bottomLiquidity)
    brokenSupport := bottomLiquidity

if (close > topLiquidity and close[1] <= topLiquidity)
    brokenResistance := topLiquidity

plot(brokenSupport, title="Retest Target (Short)", color=color.new(color.orange, 50), style=plot.style_cross, linewidth=1)
plot(brokenResistance, title="Retest Target (Long)", color=color.new(color.aqua, 50), style=plot.style_cross, linewidth=1)

// ==========================================
// 6. SWEEP & DIVERGENCE TRIGGERS
// ==========================================
isGap = (low > high[1]) or (high < low[1])

sweepUp = (high > topLiquidity and close < topLiquidity) and (not isGap or not ignorarGaps)
sweepDown = (low < bottomLiquidity and close > bottomLiquidity) and (not isGap or not ignorarGaps)

bearDiv = sweepUp and (rsi < topRsi)
bullDiv = sweepDown and (rsi > botRsi)

// ==========================================
// 7. SNIPER TRIGGER: THE RETEST (S/R FLIP)
// ==========================================
retesteBaixa = (high >= brokenSupport) and (close < brokenSupport) and (open < brokenSupport)
retesteAlta = (low <= brokenResistance) and (close > brokenResistance) and (open > brokenResistance)

// ==========================================
// 8. PLOTTING (FIGHTER HUD)
// ==========================================
// Simple Signals (Toggleable)
plotshape(mostrarSimples and sweepUp and not bearDiv and not sweepUp[1], title="Simple Top Sweep", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
plotshape(mostrarSimples and sweepDown and not bullDiv and not sweepDown[1], title="Simple Bottom Sweep", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)

// Main Signals (Gold)
plotshape(bearDiv and not bearDiv[1], title="BEAR DIV", location=location.abovebar, color=color.purple, style=shape.labeldown, text="BEAR\nDIV", textcolor=color.white, size=size.small)
plotshape(bullDiv and not bullDiv[1], title="BULL DIV", location=location.belowbar, color=color.teal, style=shape.labelup, text="BULL\nDIV", textcolor=color.white, size=size.small)

// Retest Signals
plotshape(retesteBaixa and not retesteBaixa[1], title="SHORT RETEST", location=location.abovebar, color=color.orange, style=shape.xcross, text="RETEST\nSHORT", textcolor=color.orange, size=size.small)
plotshape(retesteAlta and not retesteAlta[1], title="LONG RETEST", location=location.belowbar, color=color.aqua, style=shape.xcross, text="RETEST\nLONG", textcolor=color.aqua, size=size.small)

// ==========================================
// 9. ALERTS
// ==========================================
alertcondition(bearDiv and not bearDiv[1], title="🔴 SELL (Top)", message="Short Opportunity (Divergence & Sweep)")
alertcondition(bullDiv and not bullDiv[1], title="🟢 BUY (Bottom)", message="Long Opportunity (Divergence & Sweep)")
alertcondition(retesteBaixa and not retesteBaixa[1], title="⚠️ SNIPER ALERT: Short Retest", message="Price retesting broken support. Short Opportunity!")
alertcondition(retesteAlta and not retesteAlta[1], title="⚠️ SNIPER ALERT: Long Retest", message="Price retesting broken resistance. Long Opportunity!")

Overview

Leviathan Protocol Ultimate Sniper plots swing high and low liquidity levels using pivot points and tracks broken levels as retest targets. When price breaches a key level and closes back within the range, the script highlights liquidity sweeps, with an option to filter for RSI divergence. It also plots a 200-period EMA with an inertia-based future projection line. Configurable inputs include swing length, RSI parameters, EMA projection, and gap filtering.

Details

Published by

theonetrade on GitHub

Draws

On the price chart

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.

Topics

algorithmic-tradingbacktestingbitcoinccxtcrypto-tradingllm-agentoffline-backtestingopen-source-tradingpine-scriptpine-to-pythonpinescriptpynecorepythonquantquantitative-financestrategy-backtestingtechnical-analysistrading-indicatorstrading-strategiestradingview

Settings

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

SettingTypeDefaultVariable
Liquidity Period (Swing)int29length
RSI Periodint14rsiLen
Main EMA Periodint200emaLen
EMA Future Projection (Candles)int30futuro
Inertia Smoothingint5suavizacao
Ignore GAP Signals (Stocks/Forex)booltrueignorarGaps
Show Simple Sweeps (No Divergence)boolfalsemostrarSimples
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

SahanS Full Indicator

by sahansbandara
1 stars

An all-in-one overlay indicator that merges a divergence detector, smart money concepts, order blocks, liquidity swings and moving averages. The divergence part checks regular and hidden divergences between price and up to ten oscillators including RSI, MACD,

Indicator v5 DivergenceSMC / ICT / price action
Updated 6 months ago · None stated GitHub repository of SahanS Full Indicator
23 stars

This indicator collection calculates and plots previous daily high and low price levels on the chart to identify potential supply and demand zones. It includes real-time intraday high and low calculations, RSI divergence detection across a customizable period

Indicator v4 Support & resistanceDivergence
Updated 3 years ago · None stated GitHub repository of Daily High and Low Strategy

Bandz HTF

by samuelharting
18 stars

Bandz HTF projects higher-timeframe candle structures, ranges, and key levels directly onto the main price chart. It visualizes multiple configurable timeframe lanes from intraday to weekly alongside primary and macro range levels, including 25%, 50%, and 75%

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 6 weeks ago · MPL-2.0 GitHub repository of Bandz HTF

Larper Suite

by DeolinNaidoo
9 stars

Larper Suite is an overlay indicator for ICT and quarterly-theory analysis. It plots true session, daily, weekly, monthly, and yearly opens plus prior and current high-low liquidity levels. It tracks multi-asset SMT, swing divergence, fair-value-gap fills, and

Indicator v6 SMC / ICT / price actionDivergence Repaints
Updated 4 months ago · GPL-3.0 GitHub repository of Larper Suite
6 stars

Apex Protocol v3.0 - The SMC Engine is an overlay indicator designed for Smart Money Concepts (SMC) trading strategies. It detects market structure shifts (MSS), breaks of structure (BOS), M5 Fair Value Gaps (FVG), Order Blocks (OB), and Asian session ranges.

Indicator v5 SMC / ICT / price actionSupport & resistance Repaints
Updated 8 months ago · None stated GitHub repository of Apex Protocol v3.0 - The SMC Engine

More SMC / ICT scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers