Liquidity Sweep & CHoCH Target Zones [PhenLabs]

2 895
🎯 Overview

Liquidity Sweep & CHoCH Target Zones [PhenLabs] is an analytical overlay and trade-planning indicator built on Pine Script v6. It maps external Buy-Side Liquidity (BSL) and Sell-Side Liquidity (SSL) swing pools, detects closed-bar stop sweeps that reclaim back inside the range, waits for a confirmed internal Change of Character (CHoCH) displacement break, and projects a complete non-repainting trade plan (ENTRY, SL, TP1, TP2, TP3) once price pulls back into discount or premium and holds.

  1. Stop Hunts Without Structure Confirmation: Many sweep indicators trigger an arrow on the very first wick past a swing high or low, catching traders in runaway trend continuations. This script treats the liquidity sweep only as Stage 1 arming (SSL SWEPT or BSL SWEPT) and requires an internal 3-bar structure shift (CHoCH) backed by volume or range expansion before arming an entry.
  2. Chasing Extended Break Candles: Entering market orders at the close of an oversized displacement candle inflates stop distance and compresses reward-to-risk. In default CHoCH + Pullback (Confirmed) mode, the engine shades the 30% to 78% discount or premium retracement zone of the CHoCH leg and triggers BUY or SELL only when a closed candle tests that zone and closes back in favor of the shift while defending the sweep extreme.
  3. Complete Closed-Bar Trade Plan & Auto Profile Selection: Every confirmed entry draws a red stop-loss risk box, a green reward backdrop, crisp horizontal lines for ENTRY, SL, and TP1–TP3, and optional TP2 · MAG snapping to opposing unswept liquidity pools. Three structural profiles (Balanced, Scalp Fast, and Swing Strict) run in parallel User-Defined Type ledgers so Auto Best (by Avg R) routes live setups using the strongest profile on the active chart.



🧠 How It Works — Non-Repainting State Machine

Every signal and trade plan is governed by a four-stage closed-bar state machine (IDLE → SWEEP_ARMED → CHOCH_PULLBACK → IN_TRADE):

  1. Stage 1 — External Liquidity Sweep (SWEEP_ARMED):
    Confirmed N-bar swing highs and lows (6, 8, or 10 bars depending on the active profile) register as resting BSL (gold dotted rays) and SSL (cyan dotted rays) liquidity pools. When a candle pierces a resting pool within an ATR-bounded sweep window (0.03 to 1.35 ATR) and closes back inside the pool level on a confirmed bar, the setup arms and frames the sweep wick trap box without repainting.
  2. Stage 2 — Internal Change of Character (CHOCH_PULLBACK):
    Over the next 10 bars, the script monitors the sweep extreme (swpExt). If price closes beyond the sweep extreme, the trap is invalidated immediately. Otherwise, if price closes past the opposing 3-bar internal swing structure (hi3 for bullish shifts or lo3 for bearish shifts) with displacement effort and trend alignment, the script draws the CHoCH break line and calculates a 0–100 setup quality score.
  3. Stage 3 — Discount / Premium Retracement Entry:
    • CHoCH + Pullback (Confirmed): Projects a shaded retracement zone between 30% and 78% of the sweep-to-CHoCH impulse leg (legLo to legHi) over a 12-bar window. A BUY triggers when a bar dips into the lower 62% discount half, defends swpExt, and closes bullishly back above the 35% leg threshold (mirrored in premium for SELL).
    • CHoCH Close (Immediate): Optional faster mode for momentum traders that enters directly on the confirmed CHoCH break close whenever the break candle is not over-extended (<= 1.8 ATR from the sweep wick).
  4. Stage 4 — Trade Plan Lifecycle & Scale-Out Accounting:
    Projects ENTRY, SL (ATR Multiple or Sweep Wick + ATR Buffer), and TP1 / TP2 / TP3. Partial exits are accounted across 50% at TP1, 30% at TP2, and 20% at TP3 using conservative stop-first evaluation if both stop and target are touched on the same bar. Each target line thickens and ticks ✓ as reached, and a final +R or −R badge prints on resolution.



⚙️ Under the Hood — Mathematical Formulation

1. All-Plan Effort Proxy (Volume with Range Expansion Fallback)
To operate identically across Equities, Futures, Crypto, and volume-free Forex or CFD feeds on every TradingView plan tier, displacement effort normalizes bar volume against its 20-bar mean and automatically falls back to normalized true bar span when volume is unavailable:
Pine Script®


2. Discount / Premium CHoCH Leg Geometry & Quality Score
Once a sweep extreme (swpExt) and CHoCH break (legHi / legLo) confirm, the retracement window and composite 0–100 setup quality score combine normalized sweep depth, CHoCH candle displacement effort, body conviction, wick rejection, and EMA 50/200 alignment:
Pine Script®


3. Parallel UDT Tournament Ledgers & Opposing-Pool Magnet Target
  • Balanced (8-bar): Tracks 8-bar external liquidity pivots with a 0.85x displacement effort floor for intraday 5m–15m index futures, gold, and crypto setups.
  • Scalp Fast (6-bar): Faster 6-bar external swing pools (0.80x effort floor) suited to active 1m–5m session trading.
  • Swing Strict (10-bar): Wider 10-bar structural pools with a 0.95x displacement gate designed to isolate higher-conviction swings on 15m–4H charts.
  • Opposing Liquidity Magnet (TP2 · MAG): Scans unswept opposing BSL or SSL pools sitting between 1.15R and TP3, snapping TP2 just inside (0.05 ATR) the nearest opposing liquidity draw.



📊 Visual Walkthrough & Telemetry Dashboard

  • Setup Structure Layer: Cyan (#38BDF8) sell-side sweep boxes and pool rays, gold (#F5C542) buy-side sweep boxes and pool rays, solid CHoCH structure shift lines, and translucent PULLBACK retracement zones keep setup detection visually distinct from red/green trade risk boxes.
  • Trade Plan Projections: Crisp ENTRY, SL, and TP1–TP3 lines with right-edge price and R-multiple tags, checkmarks (✓) on hit targets, and net +R / −R completion pills.
  • Top-Right Telemetry Table: Displays active Profile and entry mode, Trend Bias (BULLISH · Longs Active, BEARISH · Shorts Active, or TRANSITION · Neutral), live state-machine State, Last Signal with quality score, closed-trade Win Rate (TP1+), Net Return in R with Profit Factor, Target Hits (TP1 / TP2 / TP3), Nearest Pools, and active Stop / Data feed mode (VOLUME vs RANGE).



🛠️ Input Guide

Group 1 — 1 · Setup & Confirmation
  • Profile: Select Auto Best (by Avg R) (default), Balanced (8-bar), Scalp Fast (6-bar), or Swing Strict (10-bar).
  • Entry Mode: Choose CHoCH + Pullback (Confirmed) (default) or CHoCH Close (Immediate).
  • Trend Filter: Choose EMA 50 & 200 Aligned (default), EMA 200 Only, or Off (All Reversals).
  • Volume / Range Displacement Filter: Requires expansion effort on the CHoCH structure break candle (default true).


Group 2 — 2 · Stop Loss & Targets
  • Stop Loss Mode: Choose ATR Multiple (default) or Sweep Wick + ATR Buffer.
  • Stop Distance / Wick Buffer (ATR): Sets the ATR stop multiplier or extra ATR breathing room past the sweep wick (default 1.50).
  • Move Stop to Break-Even at TP1: Ratchets active stop loss to Entry after TP1 is reached (default false).
  • Targets: TP1 / TP2 / TP3 (R): R-multiple targets weighted 50% / 30% / 20% (defaults 1.0, 2.0, 3.0).
  • Snap TP2 to Opposing Liquidity Pool: Snaps TP2 inside an unswept opposing BSL/SSL pool when positioned between TP1 and TP3 (default true).


Group 3 — 3 · Display & Declutter
  • Show: Sweep Traps / CHoCH / Pools: Independent checkboxes for sweep wick boxes, CHoCH lines, and active BSL/SSL pool rays.
  • Plan: Entry / Stop Box / TP1–TP3: Independent checkboxes for the Entry line, red Stop-Loss box/line, and green TP1–TP3 ladder.
  • Past Plans Shown: Rolling cap of completed plans kept on chart from 1 to 12 (default 4).
  • Dashboard & Size: Toggle the top-right telemetry table and choose Tiny, Small (default), or Normal.
  • Colors: Bull / Bear / Sweep: Customize bullish (#00E5A8), bearish (#FF4D6D), and liquidity sweep (#38BDF8) palette colors.



🚀 Built-In Alerts & Pine Screener Support

Six dedicated Data Window and Pine Screener plots expose confirmed signals (+1 / -1), live state (0–3), 0–100 setup quality score, liquidity sweeps, CHoCH breaks, and cumulative Net R for multi-symbol scanning, paired with seven built-in alert conditions:
  • 1. Bullish Sweep + CHoCH Entry (BUY)
  • 2. Bearish Sweep + CHoCH Entry (SELL)
  • 3. Any Confirmed Trade Plan (BUY or SELL)
  • 4. CHoCH Structure Break Armed
  • 5. BSL / SSL Liquidity Pool Swept
  • 6. Target 1 (TP1) Reached
  • 7. Stop Loss Hit



⚠️ Risk Disclaimer

This indicator is an analytical decision-support tool design

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.