本页源码来自 TradingView 公开发布的开源脚本,版权归原作者所有, 请遵循其原始许可(Pine 脚本常见 CC BY-NC-SA / MPL-2.0 / MIT)。 本项目仅用于研究检索与许可范围内的移植。
// This Pine Script™ code is subject to the terms of the MPL 2.0
// at https://mozilla.org/MPL/2.0/
// © LiquidityEdgeFutures
// ============================================================================
// LIQUIDITY EDGE | MULTI-TOUCH EQUAL HIGHS (EQH) & EQUAL LOWS (EQL) RADAR PRO
// Institutional Multi-Touch ($$$ Pools) & 'Liquidity Sought & Dropped' Engine
// With Thermal Order Flow Heatmap Zones for CME NQ1!, MNQ1!, ES1!, MES1!
//
// Elite Visual Architecture:
// - Persistent Candidate Memory: Retains up to 50 previous swing pivots across
// sessions so multi-hour/multi-day equal highs are never lost
// - Auto-Adaptive Tolerance: Automatically scales tolerance based on ATR so
// heatmaps detect cleanly across ALL timeframes (1m, 5m, 15m, 1H)
// - Dynamic Thermal Heatmap Zones: Rich glowing order-density depth boxes
// showing exact resting stop-loss clusters
// - Highlights Every Touch Point: Micro-badges on each equal pivot (#1, #2...)
// - 'Liquidity Sought & Dropped' Radar: Flags exact bar where liquidity was
// purged and immediately rejected with bearish/bullish displacement
// - High-Visibility Desk Telemetry HUD: Live telemetry of active pools & HUD
// ============================================================================
//@version=6
indicator(
title="Liquidity Edge - Multi-Touch EQH/EQL & Heatmap Radar PRO",
shorttitle="LE - Multi-EQH/EQL & Heatmap PRO",
overlay=true,
max_boxes_count=100,
max_lines_count=500,
max_labels_count=500
)
// ----------------------------------------------------------------------------
// INPUT CONFIGURATION
// ----------------------------------------------------------------------------
var string G_EQH = "1. Multi-Touch Equal Highs & Lows ($$$ Pools)"
var string G_HEAT = "2. Liquidity Heatmap & Order Density Zones"
var string G_PURGE = "3. 'Liquidity Sought & Dropped' Reversal Radar"
var string G_SESSIONS = "4. Session Ranges (Asia & London)"
var string G_HUD = "5. High-Visibility Desk Telemetry HUD"
var string G_ALERTS = "6. Audio & Webhook Alerts"
// 1. Multi-Touch EQH / EQL Configuration
bool i_showEqhEql = input.bool(
true,
"Show Multi-Touch Equal Highs / Lows ($$$ Pools)",
group=G_EQH
)
string i_tolMode = input.string(
"Auto-Adaptive ATR (All Timeframes)",
"Tolerance Mode",
options=[
"Auto-Adaptive ATR (All Timeframes)",
"Fixed Points",
"Fixed Ticks"
],
tooltip="Auto-Adaptive scales to any timeframe (1m, 5m, 15m). " +
"Fixed Ticks/Points uses static values.",
group=G_EQH
)
float i_autoAtrMult = input.float(
0.15,
"Auto ATR Tolerance Multiplier",
minval=0.05,
maxval=0.60,
step=0.05,
tooltip="Multiplier of 14-period ATR for tolerance spread. " +
"0.15 is ideal for NQ/ES across all timeframes.",
group=G_EQH
)
float i_eq_pts = input.float(
3.0,
"Fixed Points Tolerance (if Fixed Points selected)",
minval=0.25,
maxval=50.0,
step=0.5,
group=G_EQH
)
int i_eq_ticks = input.int(
8,
"Fixed Ticks Tolerance (if Fixed Ticks selected)",
minval=1,
maxval=50,
tooltip="For NQ (0.25 tick), 8 ticks = 2.00 pts.",
group=G_EQH
)
int i_minTouches = input.int(
2,
"Minimum Touches to Confirm Pool",
minval=2,
maxval=5,
tooltip="2 = Twin Pivots (Standard), 3 = Triple Highs (High Priority).",
group=G_EQH
)
int i_swing_len = input.int(
5,
"Swing Pivot Lookback Length",
minval=2,
maxval=15,
tooltip="Pivot detection strength (5 is institutional standard).",
group=G_EQH
)
int i_maxPools = input.int(
8,
"Max Active Pools Displayed",
minval=2,
maxval=20,
tooltip="Caps active unmitigated pools displayed on chart.",
group=G_EQH
)
bool i_highlightTouches = input.bool(
true,
"Highlight Each Touch Point (EQH #1, #2, #3...)",
tooltip="Places sleek micro-badges on each equal high/low pivot.",
group=G_EQH
)
bool i_extendPools = input.bool(
true,
"Project Liquidity Rays Forward to Current Bar",
group=G_EQH
)
string i_labelPos = input.string(
"Right Margin (Cleanest)",
"Label Position",
options=[
"Right Margin (Cleanest)",
"At Pivot Origin",
"Off (Lines Only)"
],
tooltip="Right margin keeps candles 100% unobstructed.",
group=G_EQH
)
string i_sweepAction = input.string(
"Dim & Terminate Ray",
"When Pool is Swept",
options=[
"Dim & Terminate Ray",
"Delete Ray on Purge",
"Keep Intact"
],
group=G_EQH
)
color i_c_eqh = input.color(
#FF2A5F,
"EQH (Buy-Side Liquidity $$$) Color",
group=G_EQH
)
color i_c_eql = input.color(
#10B981,
"EQL (Sell-Side Liquidity $$$) Color",
group=G_EQH
)
// 2. Liquidity Heatmap Zones
bool i_showHeatmap = input.bool(
true,
"Draw Liquidity Heatmap Zones (Depth Boxes)",
tooltip="Thermal order-density heatmap zone covering the cluster.",
group=G_HEAT
)
int i_heatBuffer = input.int(
4,
"Stop Loss Cluster Buffer (Ticks)",
minval=0,
maxval=30,
tooltip="Projected retail stop-loss cluster buffer above/below peaks.",
group=G_HEAT
)
string i_heatStyle = input.string(
"Dynamic Thermal Glow (Heatmap)",
"Heatmap Intensity Mode",
options=[
"Dynamic Thermal Glow (Heatmap)",
"Subtle Glassmorphism (Uniform)",
"Outlines Only"
],
group=G_HEAT
)
// 3. 'Liquidity Sought & Dropped' Engine
bool i_showPurgeDrop = input.bool(
true,
"Flag 'Liquidity Sought & Dropped' Reversals",
tooltip="Flags bar where liquidity was purged and market reversed.",
group=G_PURGE
)
string i_purgeSignalStyle = input.string(
"Sleek Micro Badges",
"Reversal Signal Style",
options=[
"Sleek Micro Badges",
"Minimalist Chevrons",
"Off"
],
group=G_PURGE
)
color i_c_drop = input.color(
#EF4444,
"Purge & Drop Signal Color (Bearish)",
group=G_PURGE
)
color i_c_rally = input.color(
#10B981,
"Purge & Rally Signal Color (Bullish)",
group=G_PURGE
)
// 4. Session Ranges
bool i_showSessions = input.bool(
true,
"Highlight Asia & London Ranges",
group=G_SESSIONS
)
bool i_showAsia = input.bool(
true,
"Show Asia Session (18:00 - 00:00 EST)",
group=G_SESSIONS
)
color i_c_asia = input.color(
color.new(#818CF8, 94),
"Asia Range Tint",
group=G_SESSIONS
)
color i_c_asia_line = input.color(
color.new(#818CF8, 40),
"Asia High / Low Lines",
group=G_SESSIONS
)
bool i_showLondon = input.bool(
true,
"Show London Session (02:00 - 05:00 EST)",
group=G_SESSIONS
)
color i_c_london = input.color(
color.new(#06B6D4, 94),
"London Range Tint",
group=G_SESSIONS
)
color i_c_lon_line = input.color(
color.new(#06B6D4, 40),
"London High / Low Lines",
group=G_SESSIONS
)
string i_sweepStyle = input.string(
"Sleek Micro Badges",
"Session Sweep Signal Style",
options=[
"Sleek Micro Badges",
"Minimalist Chevrons",
"Standard Text Badges",
"Off"
],
group=G_SESSIONS
)
// 5. Desk Telemetry HUD
bool i_showHud = input.bool(
true,
"Display Desk Telemetry HUD",
group=G_HUD
)
string i_hudPosition = input.string(
"Top Right",
"HUD Position",
options=[
"Top Right",
"Bottom Right",
"Top Left",
"Bottom Left"
],
group=G_HUD
)
string i_hudSize = input.string(
"Normal (Readable)",
"HUD Text Size",
options=[
"Normal (Readable)",
"Large (High-Res Monitors)",
"Compact (Small)"
],
tooltip="Adjust sizing to match your monitor resolution.",
group=G_HUD
)
// 6. Alerts
bool i_alt_eqh_drop = input.bool(
true,
"Alert: Liquidity Sought & Dropped (Bearish)",
group=G_ALERTS
)
bool i_alt_eql_rally = input.bool(
true,
"Alert: Liquidity Sought & Rallied (Bullish)",
group=G_ALERTS
)
bool i_alt_eqh_multi = input.bool(
true,
"Alert: Multi-Touch Equal Highs Formed (3x+)",
group=G_ALERTS
)
bool i_alt_lon_sweep = input.bool(
true,
"Alert: London Range Swept",
group=G_ALERTS
)
// ----------------------------------------------------------------------------
// SESSION TIMING CHECKS (New York Timezone)
// ----------------------------------------------------------------------------
t_asia = not na(
time(timeframe.period, "1800-0000:1234567", "America/New_York")
)
t_london = not na(
time(timeframe.period, "0200-0500:23456", "America/New_York")
)
t_ny = not na(
time(timeframe.period, "0930-1600:23456", "America/New_York")
)
// Background tinting
bgcolor(
i_showSessions and i_showAsia and t_asia ? i_c_asia : na,
title="Asia Session Background"
)
bgcolor(
i_showSessions and i_showLondon and t_london ? i_c_london : na,
title="London Session Background"
)
// ----------------------------------------------------------------------------
// ASIA & LONDON RANGE TRACKING
// ----------------------------------------------------------------------------
var float asia_high = na
var float asia_low = na
var line ln_asia_h = na
var line ln_asia_l = na
var label lbl_asia_h = na
var label lbl_asia_l = na
var bool asia_h_swept = false
var bool asia_l_swept = false
if t_asia and not t_asia[1]
asia_high := high
asia_low := low
asia_h_swept := false
asia_l_swept := false
else if t_asia
asia_high := math.max(asia_high, high)
asia_low := math.min(asia_low, low)
if not t_asia and not na(asia_high) and barstate.islast and i_showAsia
line.delete(ln_asia_h)
line.delete(ln_asia_l)
label.delete(lbl_asia_h)
label.delete(lbl_asia_l)
int rightMargin = bar_index + 6
ln_asia_h := line.new(
x1=bar_index - 30,
y1=asia_high,
x2=rightMargin,
y2=asia_high,
color=i_c_asia_line,
style=line.style_dashed,
width=1
)
ln_asia_l := line.new(
x1=bar_index - 30,
y1=asia_low,
x2=rightMargin,
y2=asia_low,
color=i_c_asia_line,
style=line.style_dashed,
width=1
)
if i_labelPos != "Off (Lines Only)"
lbl_asia_h := label.new(
x=rightMargin + 1,
y=asia_high,
text="ASIA HIGH [" + str.tostring(asia_high, "#.##") + "]",
color=color.new(#0D1526, 15),
textcolor=#818CF8,
style=label.style_label_left,
size=size.tiny
)
lbl_asia_l := label.new(
x=rightMargin + 1,
y=asia_low,
text="ASIA LOW [" + str.tostring(asia_low, "#.##") + "]",
color=color.new(#0D1526, 15),
textcolor=#818CF8,
style=label.style_label_left,
size=size.tiny
)
var float london_high = na
var float london_low = na
var line ln_lon_h = na
var line ln_lon_l = na
var label lbl_lon_h = na
var label lbl_lon_l = na
var bool lon_h_swept = false
var bool lon_l_swept = false
if t_london and not t_london[1]
london_high := high
london_low := low
lon_h_swept := false
lon_l_swept := false
else if t_london
london_high := math.max(london_high, high)
london_low := math.min(london_low, low)
if not t_london and not na(london_high) and barstate.islast and i_showLondon
line.delete(ln_lon_h)
line.delete(ln_lon_l)
label.delete(lbl_lon_h)
label.delete(lbl_lon_l)
int rightMargin = bar_index + 6
ln_lon_h := line.new(
x1=bar_index - 30,
y1=london_high,
x2=rightMargin,
y2=london_high,
color=i_c_lon_line,
style=line.style_solid,
width=1
)
ln_lon_l := line.new(
x1=bar_index - 30,
y1=london_low,
x2=rightMargin,
y2=london_low,
color=i_c_lon_line,
style=line.style_solid,
width=1
)
if i_labelPos != "Off (Lines Only)"
lbl_lon_h := label.new(
x=rightMargin + 1,
y=london_high,
text="LONDON HIGH [" + str.tostring(london_high, "#.##") + "]",
color=color.new(#0D1526, 15),
textcolor=#06B6D4,
style=label.style_label_left,
size=size.tiny
)
lbl_lon_l := label.new(
x=rightMargin + 1,
y=london_low,
text="LONDON LOW [" + str.tostring(london_low, "#.##") + "]",
color=color.new(#0D1526, 15),
textcolor=#06B6D4,
style=label.style_label_left,
size=size.tiny
)
// Session Sweeps during NY (Single de-duplicated trigger per session)
bool trig_lon_h = t_ny and not lon_h_swept and
not na(london_high) and (high > london_high)
bool trig_lon_l = t_ny and not lon_l_swept and
not na(london_low) and (low < london_low)
if trig_lon_h
lon_h_swept := true
if trig_lon_l
lon_l_swept := true
// Sweep Marker Rendering
bool useMicro = i_sweepStyle == "Sleek Micro Badges"
bool useChevrons = i_sweepStyle == "Minimalist Chevrons"
bool useStdBadges = i_sweepStyle == "Standard Text Badges"
if useMicro and trig_lon_h
label.new(
x=bar_index,
y=high,
text="⚡ LONDON HIGH SWEPT",
yloc=yloc.abovebar,
color=color.new(#0D1526, 15),
textcolor=i_c_eqh,
style=label.style_label_down,
size=size.tiny
)
if useMicro and trig_lon_l
label.new(
x=bar_index,
y=low,
text="⚡ LONDON LOW SWEPT",
yloc=yloc.belowbar,
color=color.new(#0D1526, 15),
textcolor=i_c_eql,
style=label.style_label_up,
size=size.tiny
)
plotshape(
useChevrons and trig_lon_h,
title="London High Swept (Chevron)",
style=shape.triangledown,
location=location.abovebar,
color=i_c_eqh,
size=size.small
)
plotshape(
useChevrons and trig_lon_l,
title="London Low Swept (Chevron)",
style=shape.triangleup,
location=location.belowbar,
color=i_c_eql,
size=size.small
)
plotshape(
useStdBadges and trig_lon_h,
title="London High Swept (Badge)",
style=shape.triangledown,
location=location.abovebar,
color=i_c_eqh,
size=size.small,
text="LONDON HIGH SWEPT ($$$)"
)
plotshape(
useStdBadges and trig_lon_l,
title="London Low Swept (Badge)",
style=shape.triangleup,
location=location.belowbar,
color=i_c_eql,
size=size.small,
text="LONDON LOW SWEPT ($$$)"
)
// ----------------------------------------------------------------------------
// MULTI-TOUCH EQUAL HIGHS (EQH) & EQUAL LOWS (EQL) ENGINE
// ----------------------------------------------------------------------------
type CandidatePivot
float price
int bar_idx
bool isHigh
type MultiPool
line ln_ray
box bx_heat
label lbl_right
float price
float min_price
float max_price
int first_bar
int last_bar
int touches
bool isHigh
bool isSwept
bool dropConfirmed
label[] touch_lbls
var CandidatePivot[] candHighs = array.new<CandidatePivot>()
var CandidatePivot[] candLows = array.new<CandidatePivot>()
var MultiPool[] activePools = array.new<MultiPool>()
f_purgePool(MultiPool p) =>
if not na(p.ln_ray)
line.delete(p.ln_ray)
if not na(p.bx_heat)
box.delete(p.bx_heat)
if not na(p.lbl_right)
label.delete(p.lbl_right)
if array.size(p.touch_lbls) > 0
for j = 0 to array.size(p.touch_lbls) - 1
label.delete(array.get(p.touch_lbls, j))
// Heatmap Color Resolvers (High contrast visible alpha)
f_heatBg(color c, int touches, string style) =>
int a = 80
if style == "Outlines Only"
a := 100
else if style == "Subtle Glassmorphism (Uniform)"
a := 85
else
// Dynamic Thermal Glow
a := touches == 2 ? 80 : (touches == 3 ? 68 : 52)
color.new(c, a)
f_heatBorder(color c, int touches, string style) =>
int a = touches == 2 ? 50 : (touches == 3 ? 30 : 10)
color.new(c, a)
// Calculate Tolerance (Adaptive ATR vs Fixed)
float atrVal = ta.atr(14)
float tolerance = i_tolMode == "Fixed Points" ? i_eq_pts :
(i_tolMode == "Fixed Ticks" ? i_eq_ticks * syminfo.mintick :
math.max(syminfo.mintick * 4.0, atrVal * i_autoAtrMult))
float heatBuffer = math.max(
i_heatBuffer * syminfo.mintick,
tolerance * 0.4
)
float ph = ta.pivothigh(high, i_swing_len, i_swing_len)
float pl = ta.pivotlow(low, i_swing_len, i_swing_len)
bool event_eqh_drop = false
bool event_eql_rally = false
bool event_eqh_multi = false
// Process New Pivot High
if not na(ph) and i_showEqhEql
int cur_idx = bar_index - i_swing_len
bool matched = false
// Step 1: Check active confirmed pools first
if array.size(activePools) > 0
for i = 0 to array.size(activePools) - 1
MultiPool pool = array.get(activePools, i)
if pool.isHigh and not pool.isSwept
if math.abs(ph - pool.price) <= tolerance
// Increment touch on existing pool
pool.touches += 1
pool.last_bar := cur_idx
pool.min_price := math.min(pool.min_price, ph)
pool.max_price := math.max(pool.max_price, ph)
float prevSum = pool.price * (pool.touches - 1)
pool.price := (prevSum + ph) / pool.touches
if pool.touches >= 3
event_eqh_multi := true
// Add micro-badge on this touch pivot
if i_highlightTouches
string tStr = "EQH #" + str.tostring(pool.touches)
label tLbl = label.new(
x=cur_idx,
y=ph,
text=tStr,
color=color.new(#0D1526, 15),
textcolor=i_c_eqh,
style=label.style_label_down,
size=size.tiny
)
array.push(pool.touch_lbls, tLbl)
// Update central ray
if not na(pool.ln_ray)
line.set_y1(pool.ln_ray, pool.price)
line.set_y2(pool.ln_ray, pool.price)
line.set_x2(pool.ln_ray, bar_index + 4)
// Update heatmap box thermal density
if not na(pool.bx_heat)
float minH = tolerance * 0.4
float hTop = math.max(
pool.max_price + heatBuffer, pool.price + minH
)
float hBtm = math.min(pool.min_price, pool.price - minH)
box.set_top(pool.bx_heat, hTop)
box.set_bottom(pool.bx_heat, hBtm)
box.set_right(pool.bx_heat, bar_index + 4)
color bgC = f_heatBg(
i_c_eqh, pool.touches, i_heatStyle
)
color bdC = f_heatBorder(
i_c_eqh, pool.touches, i_heatStyle
)
box.set_bgcolor(pool.bx_heat, bgC)
box.set_border_color(pool.bx_heat, bdC)
int bWidth = pool.touches >= 4 ? 2 : 1
box.set_border_width(pool.bx_heat, bWidth)
// Update right-margin badge text
if not na(pool.lbl_right)
string pStr = str.tostring(pool.price, "#.##")
string tCount = str.tostring(pool.touches)
string tag = "🔥 MULTI-EQH [" + tCount +
"x $$$$] · " + pStr
label.set_text(pool.lbl_right, tag)
label.set_y(pool.lbl_right, pool.price)
label.set_x(pool.lbl_right, bar_index + 5)
matched := true
break
// Step 2: Check candidate highs registry if not matched to active pool
if not matched and array.size(candHighs) > 0
for j = array.size(candHighs) - 1 to 0
CandidatePivot cand = array.get(candHighs, j)
if math.abs(ph - cand.price) <= tolerance
// Found 2nd touch! Promote candidate to confirmed pool
float avgP = (cand.price + ph) / 2.0
float minP = math.min(cand.price, ph)
float maxP = math.max(cand.price, ph)
int firstB = cand.bar_idx
int projX = bar_index + 4
label[] tLbls = array.new<label>()
// Touch badges
if i_highlightTouches
label t1 = label.new(
x=firstB,
y=cand.price,
text="EQH #1",
color=color.new(#0D1526, 15),
textcolor=i_c_eqh,
style=label.style_label_down,
size=size.tiny
)
label t2 = label.new(
x=cur_idx,
y=ph,
text="EQH #2",
color=color.new(#0D1526, 15),
textcolor=i_c_eqh,
style=label.style_label_down,
size=size.tiny
)
array.push(tLbls, t1)
array.push(tLbls, t2)
// Central order flow ray
line rLine = line.new(
x1=firstB,
y1=avgP,
x2=projX,
y2=avgP,
color=color.new(i_c_eqh, 20),
width=2,
style=line.style_solid
)
// Heatmap Density Zone
box hBox = na
if i_showHeatmap
float minH = tolerance * 0.4
float hTop = math.max(maxP + heatBuffer, avgP + minH)
float hBtm = math.min(minP, avgP - minH)
color bgC = f_heatBg(i_c_eqh, 2, i_heatStyle)
color bdC = f_heatBorder(i_c_eqh, 2, i_heatStyle)
hBox := box.new(
left=firstB,
top=hTop,
right=projX,
bottom=hBtm,
border_color=bdC,
border_width=1,
border_style=line.style_dashed,
bgcolor=bgC
)
// Dynamic Status Tag
label sLbl = na
if i_labelPos != "Off (Lines Only)"
int lx = (i_labelPos == "Right Margin (Cleanest)") ?
projX + 1 : firstB
l_style = (i_labelPos == "Right Margin (Cleanest)") ?
label.style_label_left : label.style_label_down
string pStr = str.tostring(avgP, "#.##")
string tag = "🔥 EQH HEATMAP [2x] · " + pStr
sLbl := label.new(
x=lx,
y=avgP,
text=tag,
color=color.new(#0D1526, 10),
textcolor=i_c_eqh,
style=l_style,
size=size.tiny
)
MultiPool np = MultiPool.new(
ln_ray=rLine,
bx_heat=hBox,
lbl_right=sLbl,
price=avgP,
min_price=minP,
max_price=maxP,
first_bar=firstB,
last_bar=cur_idx,
touches=2,
isHigh=true,
isSwept=false,
dropConfirmed=false,
touch_lbls=tLbls
)
array.push(activePools, np)
array.remove(candHighs, j)
matched := true
break
// Step 3: Register as candidate if still unmatched
if not matched
CandidatePivot newCand = CandidatePivot.new(
price=ph,
bar_idx=cur_idx,
isHigh=true
)
array.push(candHighs, newCand)
while array.size(candHighs) > 50
array.shift(candHighs)
// Process New Pivot Low
if not na(pl) and i_showEqhEql
int cur_idx = bar_index - i_swing_len
bool matched = false
// Step 1: Check active confirmed pools
if array.size(activePools) > 0
for i = 0 to array.size(activePools) - 1
MultiPool pool = array.get(activePools, i)
if not pool.isHigh and not pool.isSwept
if math.abs(pl - pool.price) <= tolerance
// Increment touch
pool.touches += 1
pool.last_bar := cur_idx
pool.min_price := math.min(pool.min_price, pl)
pool.max_price := math.max(pool.max_price, pl)
float prevSum = pool.price * (pool.touches - 1)
pool.price := (prevSum + pl) / pool.touches
// Add micro-badge
if i_highlightTouches
string tStr = "EQL #" + str.tostring(pool.touches)
label tLbl = label.new(
x=cur_idx,
y=pl,
text=tStr,
color=color.new(#0D1526, 15),
textcolor=i_c_eql,
style=label.style_label_up,
size=size.tiny
)
array.push(pool.touch_lbls, tLbl)
// Update central ray
if not na(pool.ln_ray)
line.set_y1(pool.ln_ray, pool.price)
line.set_y2(pool.ln_ray, pool.price)
line.set_x2(pool.ln_ray, bar_index + 4)
// Update heatmap box
if not na(pool.bx_heat)
float minH = tolerance * 0.4
float hTop = math.max(pool.max_price, pool.price + minH)
float hBtm = math.min(
pool.min_price - heatBuffer, pool.price - minH
)
box.set_top(pool.bx_heat, hTop)
box.set_bottom(pool.bx_heat, hBtm)
box.set_right(pool.bx_heat, bar_index + 4)
color bgC = f_heatBg(
i_c_eql, pool.touches, i_heatStyle
)
color bdC = f_heatBorder(
i_c_eql, pool.touches, i_heatStyle
)
box.set_bgcolor(pool.bx_heat, bgC)
box.set_border_color(pool.bx_heat, bdC)
int bWidth = pool.touches >= 4 ? 2 : 1
box.set_border_width(pool.bx_heat, bWidth)
// Update right-margin badge
if not na(pool.lbl_right)
string pStr = str.tostring(pool.price, "#.##")
string tCount = str.tostring(pool.touches)
string tag = "🔥 MULTI-EQL [" + tCount +
"x $$$$] · " + pStr
label.set_text(pool.lbl_right, tag)
label.set_y(pool.lbl_right, pool.price)
label.set_x(pool.lbl_right, bar_index + 5)
matched := true
break
// Step 2: Check candidate lows registry
if not matched and array.size(candLows) > 0
for j = array.size(candLows) - 1 to 0
CandidatePivot cand = array.get(candLows, j)
if math.abs(pl - cand.price) <= tolerance
float avgP = (cand.price + pl) / 2.0
float minP = math.min(cand.price, pl)
float maxP = math.max(cand.price, pl)
int firstB = cand.bar_idx
int projX = bar_index + 4
label[] tLbls = array.new<label>()
if i_highlightTouches
label t1 = label.new(
x=firstB,
y=cand.price,
text="EQL #1",
color=color.new(#0D1526, 15),
textcolor=i_c_eql,
style=label.style_label_up,
size=size.tiny
)
label t2 = label.new(
x=cur_idx,
y=pl,
text="EQL #2",
color=color.new(#0D1526, 15),
textcolor=i_c_eql,
style=label.style_label_up,
size=size.tiny
)
array.push(tLbls, t1)
array.push(tLbls, t2)
line rLine = line.new(
x1=firstB,
y1=avgP,
x2=projX,
y2=avgP,
color=color.new(i_c_eql, 20),
width=2,
style=line.style_solid
)
box hBox = na
if i_showHeatmap
float minH = tolerance * 0.4
float hTop = math.max(maxP, avgP + minH)
float hBtm = math.min(minP - heatBuffer, avgP - minH)
color bgC = f_heatBg(i_c_eql, 2, i_heatStyle)
color bdC = f_heatBorder(i_c_eql, 2, i_heatStyle)
hBox := box.new(
left=firstB,
top=hTop,
right=projX,
bottom=hBtm,
border_color=bdC,
border_width=1,
border_style=line.style_dashed,
bgcolor=bgC
)
label sLbl = na
if i_labelPos != "Off (Lines Only)"
int lx = (i_labelPos == "Right Margin (Cleanest)") ?
projX + 1 : firstB
l_style = (i_labelPos == "Right Margin (Cleanest)") ?
label.style_label_left : label.style_label_up
string pStr = str.tostring(avgP, "#.##")
string tag = "🔥 EQL HEATMAP [2x] · " + pStr
sLbl := label.new(
x=lx,
y=avgP,
text=tag,
color=color.new(#0D1526, 10),
textcolor=i_c_eql,
style=l_style,
size=size.tiny
)
MultiPool np = MultiPool.new(
ln_ray=rLine,
bx_heat=hBox,
lbl_right=sLbl,
price=avgP,
min_price=minP,
max_price=maxP,
first_bar=firstB,
last_bar=cur_idx,
touches=2,
isHigh=false,
isSwept=false,
dropConfirmed=false,
touch_lbls=tLbls
)
array.push(activePools, np)
array.remove(candLows, j)
matched := true
break
// Step 3: Register candidate low
if not matched
CandidatePivot newCand = CandidatePivot.new(
price=pl,
bar_idx=cur_idx,
isHigh=false
)
array.push(candLows, newCand)
while array.size(candLows) > 50
array.shift(candLows)
// Clean candidate pivots broken cleanly by price
if barstate.isconfirmed
if array.size(candHighs) > 0
for h = array.size(candHighs) - 1 to 0
CandidatePivot c = array.get(candHighs, h)
if close > c.price + tolerance
array.remove(candHighs, h)
if array.size(candLows) > 0
for l = array.size(candLows) - 1 to 0
CandidatePivot c = array.get(candLows, l)
if close < c.price - tolerance
array.remove(candLows, l)
// ----------------------------------------------------------------------------
// LIQUIDITY SOUGHT & DROPPED (PURGE & REVERSAL RADAR)
// ----------------------------------------------------------------------------
if barstate.isconfirmed and array.size(activePools) > 0
for i = array.size(activePools) - 1 to 0
MultiPool pool = array.get(activePools, i)
if not pool.isSwept
// Case A: High Pool Swept & Dropped (Bearish Purge)
if pool.isHigh and high >= pool.price
pool.isSwept := true
int extX = bar_index
// Detect if price rejected & dropped
bool wickRej = close < pool.price
bool bearDisp = close < open and
close < high[0] - (high[0] - low[0]) * 0.4
bool isDrop = wickRej or bearDisp
if isDrop and i_showPurgeDrop
pool.dropConfirmed := true
event_eqh_drop := true
if i_purgeSignalStyle == "Sleek Micro Badges"
string touchStr = str.tostring(pool.touches)
string priceStr = str.tostring(pool.price, "#.##")
string bTxt = "⚡ LIQUIDITY PURGED → BEARISH DROP\n" +
"[" + touchStr + "x EQH Swept · " + priceStr + "]"
label.new(
x=bar_index,
y=high,
text=bTxt,
yloc=yloc.abovebar,
color=color.new(#0D1526, 15),
textcolor=i_c_drop,
style=label.style_label_down,
size=size.tiny
)
else if i_purgeSignalStyle == "Minimalist Chevrons"
label.new(
x=bar_index,
y=high,
text="▼ DROP",
yloc=yloc.abovebar,
color=color.new(#0D1526, 15),
textcolor=i_c_drop,
style=label.style_label_down,
size=size.tiny
)
if i_sweepAction == "Delete Ray on Purge"
f_purgePool(pool)
else if i_sweepAction == "Dim & Terminate Ray"
line.set_x2(pool.ln_ray, extX)
line.set_style(pool.ln_ray, line.style_dotted)
line.set_color(pool.ln_ray, color.new(i_c_eqh, 75))
if not na(pool.bx_heat)
box.set_right(pool.bx_heat, extX)
box.set_bgcolor(
pool.bx_heat, color.new(i_c_eqh, 94)
)
box.set_border_color(
pool.bx_heat, color.new(i_c_eqh, 85)
)
if not na(pool.lbl_right)
label.set_x(pool.lbl_right, extX + 1)
string pStr = str.tostring(pool.price, "#.##")
string touchStr = str.tostring(pool.touches)
string sTxt = pool.dropConfirmed ?
"⚡ PURGED & DROPPED [" + touchStr +
"x] · " + pStr :
"⚡ SWEPT [" + touchStr + "x] · " + pStr
label.set_text(pool.lbl_right, sTxt)
color tCol = color.new(i_c_eqh, 55)
label.set_textcolor(pool.lbl_right, tCol)
// Case B: Low Pool Swept & Rallied (Bullish Purge)
else if not pool.isHigh and low <= pool.price
pool.isSwept := true
int extX = bar_index
// Detect if price rejected & rallied
bool wickRej = close > pool.price
bool bullDisp = close > open and
close > low[0] + (high[0] - low[0]) * 0.4
bool isRally = wickRej or bullDisp
if isRally and i_showPurgeDrop
pool.dropConfirmed := true
event_eql_rally := true
if i_purgeSignalStyle == "Sleek Micro Badges"
string touchStr = str.tostring(pool.touches)
string priceStr = str.tostring(pool.price, "#.##")
string bTxt = "⚡ LIQUIDITY PURGED → BULLISH RALLY\n" +
"[" + touchStr + "x EQL Swept · " + priceStr + "]"
label.new(
x=bar_index,
y=low,
text=bTxt,
yloc=yloc.belowbar,
color=color.new(#0D1526, 15),
textcolor=i_c_rally,
style=label.style_label_up,
size=size.tiny
)
else if i_purgeSignalStyle == "Minimalist Chevrons"
label.new(
x=bar_index,
y=low,
text="▲ RALLY",
yloc=yloc.belowbar,
color=color.new(#0D1526, 15),
textcolor=i_c_rally,
style=label.style_label_up,
size=size.tiny
)
if i_sweepAction == "Delete Ray on Purge"
f_purgePool(pool)
else if i_sweepAction == "Dim & Terminate Ray"
line.set_x2(pool.ln_ray, extX)
line.set_style(pool.ln_ray, line.style_dotted)
line.set_color(pool.ln_ray, color.new(i_c_eql, 75))
if not na(pool.bx_heat)
box.set_right(pool.bx_heat, extX)
box.set_bgcolor(
pool.bx_heat, color.new(i_c_eql, 94)
)
box.set_border_color(
pool.bx_heat, color.new(i_c_eql, 85)
)
if not na(pool.lbl_right)
label.set_x(pool.lbl_right, extX + 1)
string pStr = str.tostring(pool.price, "#.##")
string touchStr = str.tostring(pool.touches)
string sTxt = pool.dropConfirmed ?
"⚡ PURGED & RALLIED [" + touchStr +
"x] · " + pStr :
"⚡ SWEPT [" + touchStr + "x] · " + pStr
label.set_text(pool.lbl_right, sTxt)
color tCol = color.new(i_c_eql, 55)
label.set_textcolor(pool.lbl_right, tCol)
// Extend unswept confirmed pools forward to right margin
bool isMargin = i_labelPos == "Right Margin (Cleanest)"
if i_extendPools and not pool.isSwept
int extX = bar_index + 4
if not na(pool.ln_ray)
line.set_x2(pool.ln_ray, extX)
if not na(pool.bx_heat)
box.set_right(pool.bx_heat, extX)
if not na(pool.lbl_right) and isMargin
label.set_x(pool.lbl_right, extX + 1)
// Cap active pool memory
while array.size(activePools) > i_maxPools
MultiPool oldest = array.shift(activePools)
f_purgePool(oldest)
// ----------------------------------------------------------------------------
// HIGH-VISIBILITY DESK TELEMETRY HUD
// ----------------------------------------------------------------------------
hud_pos = i_hudPosition == "Top Right" ? position.top_right :
(i_hudPosition == "Bottom Right" ? position.bottom_right :
(i_hudPosition == "Top Left" ? position.top_left : position.bottom_left))
hud_hdrSize = i_hudSize == "Large (High-Res Monitors)" ? size.normal :
(i_hudSize == "Compact (Small)" ? size.small : size.normal)
hud_bodySize = i_hudSize == "Large (High-Res Monitors)" ? size.normal :
(i_hudSize == "Compact (Small)" ? size.tiny : size.small)
var table hud = table.new(
position=hud_pos,
columns=2,
rows=6,
bgcolor=color.new(#030712, 10),
border_color=color.new(#1E2D48, 30),
border_width=1
)
if i_showHud and barstate.islast
int unsweptEQH = 0
int unsweptEQL = 0
int maxEqhTouches = 0
int maxEqlTouches = 0
float nearestTarget = na
float minTargetDist = 99999.0
if array.size(activePools) > 0
for k = 0 to array.size(activePools) - 1
MultiPool pool = array.get(activePools, k)
if not pool.isSwept
if pool.isHigh
unsweptEQH += 1
maxEqhTouches := math.max(maxEqhTouches, pool.touches)
else
unsweptEQL += 1
maxEqlTouches := math.max(maxEqlTouches, pool.touches)
float dist = math.abs(close - pool.price)
if dist < minTargetDist
minTargetDist := dist
nearestTarget := pool.price
// Header
color hdrBg = (unsweptEQH > 0 or unsweptEQL > 0) ? #0E3B43 : #0A0F1D
table.cell(
hud, 0, 0,
"⚡ LIQUIDITY EDGE",
text_color=#38BDF8,
text_size=hud_hdrSize,
text_font_family=font.family_monospace,
bgcolor=hdrBg
)
table.cell(
hud, 1, 0,
"EQH/EQL RADAR PRO",
text_color=#F8FAFC,
text_size=hud_hdrSize,
text_font_family=font.family_monospace,
bgcolor=hdrBg
)
// Row 1: Equal Highs Pool ($$$ BSL)
string eqhTxt = unsweptEQH > 0 ?
str.tostring(unsweptEQH) + " Pools (Max " +
str.tostring(maxEqhTouches) + "x Touches)" : "No Active Pools"
color eqhCol = unsweptEQH > 0 ? #FF2A5F : #94A3B8
table.cell(
hud, 0, 1,
"Equal Highs ($$$ BSL)",
text_color=#94A3B8,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
table.cell(
hud, 1, 1,
eqhTxt,
text_color=eqhCol,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
// Row 2: Equal Lows Pool ($$$ SSL)
string eqlTxt = unsweptEQL > 0 ?
str.tostring(unsweptEQL) + " Pools (Max " +
str.tostring(maxEqlTouches) + "x Touches)" : "No Active Pools"
color eqlCol = unsweptEQL > 0 ? #10B981 : #94A3B8
table.cell(
hud, 0, 2,
"Equal Lows ($$$ SSL)",
text_color=#94A3B8,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
table.cell(
hud, 1, 2,
eqlTxt,
text_color=eqlCol,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
// Row 3: Nearest Pool Target Distance
string tgtTxt = "No Active Pools"
color tgtCol = #64748B
if not na(nearestTarget)
float diff = nearestTarget - close
string sgn = diff > 0 ? "+" : ""
tgtTxt := str.tostring(nearestTarget, "#.##") +
" (" + sgn + str.tostring(diff, "#.#") + " pts)"
tgtCol := diff > 0 ? #FF2A5F : #10B981
table.cell(
hud, 0, 3,
"Nearest Target",
text_color=#94A3B8,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
table.cell(
hud, 1, 3,
tgtTxt,
text_color=tgtCol,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
// Row 4: London Session Range
string lonTxt = not na(london_high) and not na(london_low) ?
"H: " + str.tostring(london_high, "#.#") +
" | L: " + str.tostring(london_low, "#.#") : "Pending Session"
table.cell(
hud, 0, 4,
"London Benchmarks",
text_color=#94A3B8,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
table.cell(
hud, 1, 4,
lonTxt,
text_color=#06B6D4,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
// Row 5: Session Status
string sessTxt = t_ny ? "● NY EXECUTION (Liquidity Hunt)" :
(t_london ? "● LONDON SESSION" :
(t_asia ? "● ASIA ACCUMULATION" : "○ SESSION CLOSED"))
color sessCol = t_ny ? #00F2FE :
(t_london ? #38BDF8 :
(t_asia ? #818CF8 : #64748B))
table.cell(
hud, 0, 5,
"Session Radar",
text_color=#94A3B8,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
table.cell(
hud, 1, 5,
sessTxt,
text_color=sessCol,
text_size=hud_bodySize,
text_font_family=font.family_monospace
)
// ----------------------------------------------------------------------------
// ALERTS
// ----------------------------------------------------------------------------
alertcondition(
event_eqh_drop,
title="Liquidity Sought & Dropped",
message="[Liquidity Edge] 🩸 Liquidity Sought & Dropped! Multiple Equal " +
"Highs (EQH) Swept with Bearish Rejection on {{ticker}}."
)
alertcondition(
event_eql_rally,
title="Liquidity Sought & Rallied",
message="[Liquidity Edge] 🟢 Liquidity Sought & Rallied! Multiple Equal " +
"Lows (EQL) Swept with Bullish Rejection on {{ticker}}."
)
alertcondition(
event_eqh_multi,
title="Multi-Touch EQH Formed (3x+)",
message="[Liquidity Edge] ⚠️ Multi-Touch Equal Highs (3x+) Formed on " +
"{{ticker}}! Major Resting Buy-Side Liquidity Pool."
)
alertcondition(
trig_lon_h,
title="London High Swept",
message="[Liquidity Edge] 🩸 London High Buy-Side Liquidity Swept on " +
"{{ticker}}! Watch for Bearish Reversal."
)
alertcondition(
trig_lon_l,
title="London Low Swept",
message="[Liquidity Edge] 🟢 London Low Sell-Side Liquidity Swept on " +
"{{ticker}}! Watch for Bullish Reversal."
)