Perfected FlowScript
Inducement
Inducement — SMC Liquidity Trap Detector is indexed as 156_inducement.flowscript. The exact FlowScript is viewable here; chart observe and trading automation use the current mmflow chart/recipe signal proxy until FlowScript v2 transpilation is available.
This exact FlowScript uses the v2 source dialect. It is viewable and connected to the chart/automation proxy, but direct editor execution needs the FlowScript v2 transpiler.
Dialect
flowscript-v2
Compatibility
flowscript-v2-needs-transpile
Position
onchart
Axis
false
Size
22.3 KB
Lines
535
Native Signal Candidates
11 source-level chart marker triggers extracted from guarded FlowScript v2 blocks.
Bull Inducement
line 378:9
Trigger
(showInducementZones && bullInduceActive == 1) && (showInducementLabels && bullInduceBar == barCount)
Value
bullInduceTop
Deps
barCount:static, bullInduceActive:static, bullInduceBar:static, showInducementLabels:input, showInducementZones:input
Bear Inducement
line 421:9
Trigger
(showInducementZones && bearInduceActive == 1) && (showInducementLabels && bearInduceBar == barCount)
Value
bearInduceTop
Deps
barCount:static, bearInduceActive:static, bearInduceBar:static, showInducementLabels:input, showInducementZones:input
Bull BOS
line 434:5
Trigger
(showBOSMarkers && bullBOSEvent)
Value
lastHigh
Deps
bullBOSEvent:var, showBOSMarkers:input
Bear BOS
line 444:5
Trigger
(showBOSMarkers && bearBOSEvent)
Value
lastLow
Deps
bearBOSEvent:var, showBOSMarkers:input
Bull ChoCH
line 454:5
Trigger
(showChoCHMarkers && bullChoCHEvent)
Value
lastHigh
Deps
bullChoCHEvent:var, showChoCHMarkers:input
Bear ChoCH
line 464:5
Trigger
(showChoCHMarkers && bearChoCHEvent)
Value
lastLow
Deps
bearChoCHEvent:var, showChoCHMarkers:input
Bull Induce Mitigated
line 477:9
Trigger
(showMitigationMarkers && bullInduceActive == 1 && bullInduceMitigated == 1 && bullInduceBar != barCount) && (lo <= bullInduceTop && hi >= bullInduceBot)
Value
bullInduceBot
Deps
barCount:static, bullInduceActive:static, bullInduceBar:static, bullInduceBot:static, bullInduceMitigated:static, bullInduceTop:static, hi:timeseries, lo:timeseries, showMitigationMarkers:input
Bear Induce Mitigated
line 489:9
Trigger
(showMitigationMarkers && bearInduceActive == 1 && bearInduceMitigated == 1 && bearInduceBar != barCount) && (hi >= bearInduceBot && lo <= bearInduceTop)
Value
bearInduceTop
Deps
barCount:static, bearInduceActive:static, bearInduceBar:static, bearInduceBot:static, bearInduceMitigated:static, bearInduceTop:static, hi:timeseries, lo:timeseries, showMitigationMarkers:input
Bull Grab
line 503:5
Trigger
(showLiquidityGrabs && bullGrabEvent)
Value
lo
Deps
bullGrabEvent:var, showLiquidityGrabs:input
Bear Grab
line 513:5
Trigger
(showLiquidityGrabs && bearGrabEvent)
Value
hi
Deps
bearGrabEvent:var, showLiquidityGrabs:input
Unlabeled shape
line 525:5
Trigger
(showTrendLabel && isLastBar)
Value
hi
Deps
isLastBar:builtin, showTrendLabel:input
156_inducement.flowscript
source path: kscripts/perfected/156_inducement.flowscript · sha256:96a4446252814c5aed4f81736f1f028033a368f9accb1cdeab41ddaa6318a68d
//@version=2
// ============================================================================
// Inducement — SMC Liquidity Trap & Inducement Detector
// Author: laegend1 (@laegend1) — Perfected Edition
// Tags: ADVANCED, CORE, #inducement, #smc, #liquiditytrap, #bos, #choch
//
// Production-grade Smart Money Concepts inducement detector with BOS/ChoCH
// confirmation, inducement level tracking, ATR-based zone validation,
// liquidity grab detection, and structural state machine.
//
// An inducement is the first internal pullback after a Break of Structure (BOS)
// that entices retail traders to enter prematurely — a liquidity trap before
// the true directional move. This indicator identifies these structural pivots,
// tracks inducement levels, and marks trap events with shape markers.
//
// Academic foundations:
// - Bhusal (2025), "Timing the Trap: Stop Hunt Zones & Price Manipulation"
// (SSRN 5276088). Documents engineered liquidity traps and inducement
// phases; validates stop-hunting as observable microstructure phenomenon.
// Key concept: engineered pullbacks target retail stop clusters.
// - Jones & Lipson (2005), "Are Retail Orders Different?" Institutions
// systematically counter-trade retail flow within 5 minutes. An unexpected
// retail order of 1,000 shares → 400+ institutional shares opposite.
// Validates the core SMC thesis that retail provides liquidity for smart money.
// - Zhang et al. (2023), "Agent-based Modeling of Cooperative Manipulation".
// Stop-loss orders can be exploited to ignite momentum; collusion among
// manipulators increases profits. Validates inducement as rational strategy.
// - Biais, Glosten & Spatt (2005), "Market Microstructure: A Survey".
// Framework: latent demands D(p) → realized prices/volumes via λ·ΣX_i,
// where λ = price impact coefficient. Explains why inducement zones exist
// as price-discovery inefficiencies exploited by informed traders.
// - Campbell, Ramadorai & Vuolteenaho (2005), "Caught On Tape" (NBER 11439).
// Regression method achieves ~12% R² predicting institutional ownership
// changes from trade patterns. Supports inducement zones as institutional
// accumulation/distribution footprints.
// ============================================================================
define(title="Inducement — SMC Liquidity Trap Detector", position="onchart", axis=false)
// === USER INPUTS ===
// --- Swing Detection ---
var pivotLen = input(name="pivotLen", type="number", defaultValue=5, label="Pivot Length (each side)", constraints={min: 2, max: 50, step: 1}, group="Swing Detection")
var showSwingLevels = input(name="showSwingLevels", type="boolean", defaultValue=true, label="Show Swing High/Low Lines", group="Swing Detection")
// --- Inducement Detection ---
var inducementLookback = input(name="inducementLookback", type="number", defaultValue=10, label="Inducement Search Back Window", constraints={min: 3, max: 50, step: 1}, group="Inducement")
var atrLen = input(name="atrLen", type="number", defaultValue=14, label="ATR Length", constraints={min: 5, max: 100, step: 1}, group="Inducement")
var padMult = input(name="padMult", type="number", defaultValue=0.3, label="Zone Padding (ATR Multiple)", constraints={min: 0.0, max: 3.0, step: 0.1}, group="Inducement")
var invalidMult = input(name="invalidMult", type="number", defaultValue=1.0, label="Invalidation Buffer (ATR Multiple)", constraints={min: 0.0, max: 5.0, step: 0.1}, group="Inducement")
var showInducementZones = input(name="showInducementZones", type="boolean", defaultValue=true, label="Show Inducement Zones", group="Inducement")
var showInducementLabels = input(name="showInducementLabels", type="boolean", defaultValue=true, label="Show Inducement Formation Labels", group="Inducement")
var showMitigated = input(name="showMitigated", type="boolean", defaultValue=true, label="Show Mitigated Zones", group="Inducement")
var showInvalidated = input(name="showInvalidated", type="boolean", defaultValue=true, label="Show Invalidated Zones (Gray)", group="Inducement")
// --- BOS / ChoCH ---
var showBOSMarkers = input(name="showBOSMarkers", type="boolean", defaultValue=true, label="Show BOS Markers", group="BOS / ChoCH")
var showChoCHMarkers = input(name="showChoCHMarkers", type="boolean", defaultValue=true, label="Show ChoCH Markers", group="BOS / ChoCH")
var showMitigationMarkers = input(name="showMitigationMarkers", type="boolean", defaultValue=true, label="Show Mitigation Markers", group="BOS / ChoCH")
var showTrendLabel = input(name="showTrendLabel", type="boolean", defaultValue=true, label="Show Trend State Label", group="BOS / ChoCH")
// --- Liquidity Grab ---
var showLiquidityGrabs = input(name="showLiquidityGrabs", type="boolean", defaultValue=true, label="Show Liquidity Grab Markers", group="Liquidity Grab")
var grabWickRatio = input(name="grabWickRatio", type="number", defaultValue=0.6, label="Liquidity Grab Wick Ratio", constraints={min: 0.3, max: 0.9, step: 0.05}, group="Liquidity Grab")
// --- Colors ---
var bullColor = input(name="bullColor", type="color", defaultValue="#26a69a", label="Bullish Inducement Color", group="Colors")
var bearColor = input(name="bearColor", type="color", defaultValue="#ef5350", label="Bearish Inducement Color", group="Colors")
var bullWeakColor = input(name="bullWeakColor", type="color", defaultValue="#4db6ac", label="Bullish Mitigated Color", group="Colors")
var bearWeakColor = input(name="bearWeakColor", type="color", defaultValue="#ef9a9a", label="Bearish Mitigated Color", group="Colors")
var invalidColor = input(name="invalidColor", type="color", defaultValue="#9e9e9e", label="Invalidated Color", group="Colors")
var bosColor = input(name="bosColor", type="color", defaultValue="#ffd700", label="BOS Marker Color", group="Colors")
var chochColor = input(name="chochColor", type="color", defaultValue="#ff00ff", label="ChoCH Marker Color", group="Colors")
var grabColor = input(name="grabColor", type="color", defaultValue="#ff9100", label="Liquidity Grab Color", group="Colors")
// === DATA SOURCES ===
timeseries bars = ohlcv(symbol=currentSymbol, exchange=currentExchange)
timeseries hi = bars.high
timeseries lo = bars.low
timeseries cl = bars.close
timeseries op = bars.open
// isnan guard on first use of external data — prevents NaN propagation on startup
if (isnan(cl[0]) || isnan(hi[0]) || isnan(lo[0]) || isnan(op[0])) {
return
}
// === COMPUTATION ===
// ATR (Wilder) using proper True Range formula:
// TR = max(high - low, |high - close[1]|, |low - close[1]|)
// ATR = SMA(TR, atrLen)
// Guard against isnan(close[1]) on the first bar by substituting current close.
timeseries prevClose = isnan(cl[1]) ? cl : cl[1]
timeseries tr1 = hi - lo
timeseries tr2 = math.abs(hi - prevClose)
timeseries tr3 = math.abs(lo - prevClose)
timeseries trueRange = math.max(tr1, math.max(tr2, tr3))
timeseries atr = sma(trueRange, atrLen)
timeseries atrPad = atr * padMult
timeseries invalidBuffer = atr * invalidMult
// Swing detection: pivot at [pivotLen] bars ago confirmed when current bar
// completes the right-side lookback. Formula: P_high = H_{t-p} == max(H_{t-p:t+p})
// and P_low = L_{t-p} == min(L_{t-p:t+p}).
var isSwingHigh = hi[pivotLen] == highest(hi, pivotLen * 2 + 1) && hi[pivotLen] > highest(hi, pivotLen)
var isSwingLow = lo[pivotLen] == lowest(lo, pivotLen * 2 + 1) && lo[pivotLen] < lowest(lo, pivotLen)
// Bar counter for event tracking and right-extension.
static barCount = 0
if (!isLiveUpdate) {
barCount = barCount + 1
}
// --- STATIC STATE: Market Structure ---
// Last and previous confirmed swing levels for BOS / ChoCH detection.
static lastHigh = 0.0
static lastLow = 0.0
static prevHigh = 0.0
static prevLow = 0.0
static trend = 0 // 1 = bullish, -1 = bearish
// --- STATIC STATE: BOS / ChoCH Events ---
// Bar indices where events occurred (0 = never).
static bullBOSBar = 0
static bearBOSBar = 0
static bullChoCHBar = 0
static bearChoCHBar = 0
// --- STATIC STATE: Bullish Inducement ---
// After a bullish BOS/ChoCH, the first internal pullback that sweeps liquidity
// below the previous internal high before continuing up is the inducement.
static bullInduceActive = 0
static bullInduceTop = 0.0
static bullInduceBot = 0.0
static bullInduceBar = 0
static bullInduceMitigated = 0
static bullInduceInvalidated = 0
static bullInduceBOSBar = 0
// --- STATIC STATE: Bearish Inducement ---
static bearInduceActive = 0
static bearInduceTop = 0.0
static bearInduceBot = 0.0
static bearInduceBar = 0
static bearInduceMitigated = 0
static bearInduceInvalidated = 0
static bearInduceBOSBar = 0
// --- STATIC STATE: Last Internal Levels (for inducement detection) ---
// Track the last internal high/low after a BOS for inducement validation.
static lastInternalHigh = 0.0
static lastInternalLow = 0.0
static lastInternalHighBar = 0
static lastInternalLowBar = 0
// --- STATIC STATE: Liquidity Grab Tracking ---
static lastBullGrabBar = 0
static lastBearGrabBar = 0
// Liquidity grab detection: a candle with a dominant wick that sweeps
// a nearby structural level (stop hunt) before reversing.
var rng = math.max(hi - lo, 0.0001)
var wickUp = hi - math.max(cl, op)
var wickDn = math.min(cl, op) - lo
var isBullGrab = wickDn > rng * grabWickRatio && cl > op && cl > (hi + lo) / 2.0
var isBearGrab = wickUp > rng * grabWickRatio && cl < op && cl < (hi + lo) / 2.0
// --- STATE UPDATE (only on bar close) ---
// All stateful transitions happen here to ensure consistency.
if (!isLiveUpdate) {
// Track internal highs/lows after trend establishment.
if (trend == 1) {
if (hi > lastInternalHigh || lastInternalHigh == 0.0) {
lastInternalHigh = hi
lastInternalHighBar = barCount
}
}
if (trend == -1) {
if (lo < lastInternalLow || lastInternalLow == 0.0) {
lastInternalLow = lo
lastInternalLowBar = barCount
}
}
// Swing detection and market structure classification.
// BOS = continuation of current trend (higher high in uptrend, lower low in downtrend).
// ChoCH = reversal of current trend (higher high after downtrend, lower low after uptrend).
if (isSwingHigh) {
// Shift swing highs: previous becomes prevHigh, current becomes lastHigh.
if (lastHigh > 0) {
prevHigh = lastHigh
}
lastHigh = hi[pivotLen]
// Determine BOS or ChoCH and spawn bullish inducement from internal low.
if (trend == 1 && prevHigh > 0 && lastHigh > prevHigh) {
bullBOSBar = barCount
// Bullish BOS: track internal low for inducement detection.
if (lastInternalLow > 0 && barCount - lastInternalLowBar <= inducementLookback + pivotLen) {
bullInduceTop = lastInternalLow + atrPad
bullInduceBot = lastInternalLow - atrPad
bullInduceBar = lastInternalLowBar
bullInduceActive = 1
bullInduceMitigated = 0
bullInduceInvalidated = 0
bullInduceBOSBar = barCount
}
} else if (trend == -1 && prevHigh > 0 && lastHigh > prevHigh) {
bullChoCHBar = barCount
trend = 1
// Bullish ChoCH: reset internal tracking and spawn inducement.
lastInternalLow = lo
lastInternalLowBar = barCount
lastInternalHigh = hi
lastInternalHighBar = barCount
if (lastInternalLow > 0) {
bullInduceTop = lastInternalLow + atrPad
bullInduceBot = lastInternalLow - atrPad
bullInduceBar = barCount
bullInduceActive = 1
bullInduceMitigated = 0
bullInduceInvalidated = 0
bullInduceBOSBar = barCount
}
} else if (trend == 0) {
trend = 1
lastInternalHigh = hi
lastInternalHighBar = barCount
lastInternalLow = lo
lastInternalLowBar = barCount
}
}
if (isSwingLow) {
// Shift swing lows: previous becomes prevLow, current becomes lastLow.
if (lastLow > 0) {
prevLow = lastLow
}
lastLow = lo[pivotLen]
// Determine BOS or ChoCH and spawn bearish inducement from internal high.
if (trend == -1 && prevLow > 0 && lastLow < prevLow) {
bearBOSBar = barCount
// Bearish BOS: track internal high for inducement detection.
if (lastInternalHigh > 0 && barCount - lastInternalHighBar <= inducementLookback + pivotLen) {
bearInduceTop = lastInternalHigh + atrPad
bearInduceBot = lastInternalHigh - atrPad
bearInduceBar = lastInternalHighBar
bearInduceActive = 1
bearInduceMitigated = 0
bearInduceInvalidated = 0
bearInduceBOSBar = barCount
}
} else if (trend == 1 && prevLow > 0 && lastLow < prevLow) {
bearChoCHBar = barCount
trend = -1
// Bearish ChoCH: reset internal tracking and spawn inducement.
lastInternalHigh = hi
lastInternalHighBar = barCount
lastInternalLow = lo
lastInternalLowBar = barCount
if (lastInternalHigh > 0) {
bearInduceTop = lastInternalHigh + atrPad
bearInduceBot = lastInternalHigh - atrPad
bearInduceBar = barCount
bearInduceActive = 1
bearInduceMitigated = 0
bearInduceInvalidated = 0
bearInduceBOSBar = barCount
}
} else if (trend == 0) {
trend = -1
lastInternalHigh = hi
lastInternalHighBar = barCount
lastInternalLow = lo
lastInternalLowBar = barCount
}
}
// Inducement Mitigation: price returns to the zone (touches or enters).
if (bullInduceActive == 1 && bullInduceInvalidated == 0) {
if (lo <= bullInduceTop && hi >= bullInduceBot) {
bullInduceMitigated = 1
}
}
if (bearInduceActive == 1 && bearInduceInvalidated == 0) {
if (hi >= bearInduceBot && lo <= bearInduceTop) {
bearInduceMitigated = 1
}
}
// Inducement Invalidation: price breaks through the zone in the wrong direction
// with an ATR-scaled buffer (Bhusal 2025 stop-hunt zone logic).
if (bullInduceActive == 1 && bullInduceInvalidated == 0) {
if (lo < bullInduceBot - invalidBuffer) {
bullInduceInvalidated = 1
}
}
if (bearInduceActive == 1 && bearInduceInvalidated == 0) {
if (hi > bearInduceTop + invalidBuffer) {
bearInduceInvalidated = 1
}
}
// Liquidity grab tracking (Bhusal 2025 stop-hunt documentation).
if (isBullGrab) {
lastBullGrabBar = barCount
}
if (isBearGrab) {
lastBearGrabBar = barCount
}
}
// === EVENT FLAGS FOR PLOTTING ===
var bullBOSEvent = bullBOSBar == barCount
var bearBOSEvent = bearBOSBar == barCount
var bullChoCHEvent = bullChoCHBar == barCount
var bearChoCHEvent = bearChoCHBar == barCount
var bullGrabEvent = lastBullGrabBar == barCount
var bearGrabEvent = lastBearGrabBar == barCount
// Regime detection for color coding.
var regimeColor = trend == 1 ? bullColor : (trend == -1 ? bearColor : "#ffffff")
var regimeLabel = trend == 1 ? "BULLISH STRUCTURE" : (trend == -1 ? "BEARISH STRUCTURE" : "NEUTRAL")
// === PLOTS: SWING LEVELS (plotLine) ===
if (showSwingLevels && lastHigh > 0) {
plotLine(
value=lastHigh,
width=1,
colors=["#ffffff40"],
label=["Swing High"],
desc=["Last confirmed swing high. Confirmed after right-side bars close below it."]
)
}
if (showSwingLevels && lastLow > 0) {
plotLine(
value=lastLow,
width=1,
colors=["#ffffff40"],
label=["Swing Low"],
desc=["Last confirmed swing low. Confirmed after right-side bars close above it."]
)
}
// === PLOTS: INDUCEMENT ZONES (plotLine with fill — boxes) ===
// Bullish Inducement: internal low turned support zone (liquidity trap level).
if (showInducementZones && bullInduceActive == 1) {
var bullTopColor = bullInduceInvalidated == 1 ? invalidColor : (bullInduceMitigated == 1 ? bullWeakColor : bullColor)
var bullBotColor = bullInduceInvalidated == 1 ? invalidColor : (bullInduceMitigated == 1 ? bullWeakColor : bullColor)
var bullFillOpacity = bullInduceInvalidated == 1 ? opacity(invalidColor, 30) : (bullInduceMitigated == 1 ? opacity(bullWeakColor, 40) : opacity(bullColor, 50))
if (bullInduceInvalidated == 0 || showInvalidated) {
plotLine(
value=[bullInduceTop, bullInduceBot],
width=1,
colors=[bullTopColor, bullBotColor],
fill=bullFillOpacity,
label=["Bull Induce Zone", "Bull Induce Zone"],
desc=["Bullish inducement zone — internal low liquidity trap. ATR-padded.", "Bottom boundary of bullish inducement zone."]
)
plotLine(
value=bullInduceTop,
width=1,
colors=[bullTopColor],
label=["Bull Induce Top"],
desc=["Top boundary of bullish inducement zone."]
)
plotLine(
value=bullInduceBot,
width=1,
colors=[bullBotColor],
label=["Bull Induce Bot"],
desc=["Bottom boundary of bullish inducement zone."]
)
}
if (showInducementLabels && bullInduceBar == barCount) {
plotShape(
value=bullInduceTop,
shape="rectangle",
colorIndex=bullTopColor,
width=4,
label=["Bull Inducement"],
desc=["Bullish inducement formed — internal low liquidity trap after BOS/ChoCH."]
)
}
}
// Bearish Inducement: internal high turned resistance zone (liquidity trap level).
if (showInducementZones && bearInduceActive == 1) {
var bearTopColor = bearInduceInvalidated == 1 ? invalidColor : (bearInduceMitigated == 1 ? bearWeakColor : bearColor)
var bearBotColor = bearInduceInvalidated == 1 ? invalidColor : (bearInduceMitigated == 1 ? bearWeakColor : bearColor)
var bearFillOpacity = bearInduceInvalidated == 1 ? opacity(invalidColor, 30) : (bearInduceMitigated == 1 ? opacity(bearWeakColor, 40) : opacity(bearColor, 50))
if (bearInduceInvalidated == 0 || showInvalidated) {
plotLine(
value=[bearInduceTop, bearInduceBot],
width=1,
colors=[bearTopColor, bearBotColor],
fill=bearFillOpacity,
label=["Bear Induce Zone", "Bear Induce Zone"],
desc=["Bearish inducement zone — internal high liquidity trap. ATR-padded.", "Bottom boundary of bearish inducement zone."]
)
plotLine(
value=bearInduceTop,
width=1,
colors=[bearTopColor],
label=["Bear Induce Top"],
desc=["Top boundary of bearish inducement zone."]
)
plotLine(
value=bearInduceBot,
width=1,
colors=[bearBotColor],
label=["Bear Induce Bot"],
desc=["Bottom boundary of bearish inducement zone."]
)
}
if (showInducementLabels && bearInduceBar == barCount) {
plotShape(
value=bearInduceTop,
shape="rectangle",
colorIndex=bearTopColor,
width=4,
label=["Bear Inducement"],
desc=["Bearish inducement formed — internal high liquidity trap after BOS/ChoCH."]
)
}
}
// === PLOTS: BOS / ChoCH MARKERS (plotShape) ===
if (showBOSMarkers && bullBOSEvent) {
plotShape(
value=lastHigh,
shape="triangleup",
colorIndex=bosColor,
width=6,
label=["Bull BOS"],
desc=["Bullish Break of Structure: close above previous swing high in uptrend."]
)
}
if (showBOSMarkers && bearBOSEvent) {
plotShape(
value=lastLow,
shape="triangledown",
colorIndex=bosColor,
width=6,
label=["Bear BOS"],
desc=["Bearish Break of Structure: close below previous swing low in downtrend."]
)
}
if (showChoCHMarkers && bullChoCHEvent) {
plotShape(
value=lastHigh,
shape="triangleup",
colorIndex=chochColor,
width=6,
label=["Bull ChoCH"],
desc=["Bullish Change of Character: higher high after lower lows. Trend reversal signal."]
)
}
if (showChoCHMarkers && bearChoCHEvent) {
plotShape(
value=lastLow,
shape="triangledown",
colorIndex=chochColor,
width=6,
label=["Bear ChoCH"],
desc=["Bearish Change of Character: lower low after higher highs. Trend reversal signal."]
)
}
// === PLOTS: MITIGATION MARKERS (plotShape) ===
if (showMitigationMarkers && bullInduceActive == 1 && bullInduceMitigated == 1 && bullInduceBar != barCount) {
if (lo <= bullInduceTop && hi >= bullInduceBot) {
plotShape(
value=bullInduceBot,
shape="rectangle",
colorIndex=bullWeakColor,
width=3,
label=["Bull Induce Mitigated"],
desc=["Price returned to bullish inducement zone and respected it."]
)
}
}
if (showMitigationMarkers && bearInduceActive == 1 && bearInduceMitigated == 1 && bearInduceBar != barCount) {
if (hi >= bearInduceBot && lo <= bearInduceTop) {
plotShape(
value=bearInduceTop,
shape="rectangle",
colorIndex=bearWeakColor,
width=3,
label=["Bear Induce Mitigated"],
desc=["Price returned to bearish inducement zone and respected it."]
)
}
}
// === PLOTS: LIQUIDITY GRAB MARKERS (plotShape) ===
// Bhusal 2025: engineered stop hunts with dominant wicks.
if (showLiquidityGrabs && bullGrabEvent) {
plotShape(
value=lo,
shape="triangleup",
colorIndex=grabColor,
width=5,
label=["Bull Grab"],
desc=["Liquidity grab — deep lower wick sweeps stops before reversing bullish."]
)
}
if (showLiquidityGrabs && bearGrabEvent) {
plotShape(
value=hi,
shape="triangledown",
colorIndex=grabColor,
width=5,
label=["Bear Grab"],
desc=["Liquidity grab — deep upper wick sweeps stops before reversing bearish."]
)
}
// === REGIME LABEL (plotPriceLabel) ===
if (showTrendLabel && isLastBar) {
plotPriceLabel(
price=hi,
text=regimeLabel,
type="callout",
color="#ffffff",
backgroundColor=regimeColor,
size=10,
fontWeight=700
)
}