OPEN-SOURCE SCRIPT

Vestige Liquidity Terrain [JOAT]

2 373
Vestige Liquidity Terrain [JOAT]

Introduction

The Vestige Liquidity Terrain is an open-source liquidity analysis indicator built in Pine Script v6. It detects, scores, and tracks liquidity zones — price levels where resting stop orders and limit orders tend to cluster — using pivot-based detection, volume-weighted intensity, a multi-factor scoring system, sweep tracking, and trade planning overlays. The indicator identifies where liquidity exists, how strong each zone is, whether it has been swept, and which zones are the most probable targets for price to reach next.

Liquidity is the fuel that moves markets. Institutional traders need liquidity to fill large orders, and they often engineer price moves toward areas where stop orders are concentrated. Understanding where liquidity sits, how fresh it is, and whether it has confluence with key levels gives traders a significant edge in anticipating where price is likely to travel.

快照

Why This Indicator Exists

Most liquidity zone indicators simply draw boxes at swing highs and lows. They treat all zones equally and provide no context about which zones matter most. This indicator goes further:

  • Pivot-Based Zone Detection: Uses configurable left/right pivot bars to identify swing highs and lows where resting orders accumulate. Zones are padded by a tick-based distance to account for the cluster of stops around a level.
  • Volume-Weighted Intensity: Each zone's creation is filtered by normalized volume. Only zones formed during meaningful volume activity are tracked, filtering out noise from thin-market pivots.
  • Zone Merging: When a new pivot forms within a configurable tick distance of an existing zone, the zones are merged rather than stacked. This prevents redundant zones and reflects the reality that nearby levels form a single liquidity pool.
  • Multi-Factor Scoring (0-100): Each zone receives a dynamic score based on touches, freshness, confluence with key levels, reaction speed, session alignment, and regime context. This score determines visual prominence and whether the zone qualifies as a trade planning target.
  • Sweep Tracking: When price sweeps through a zone, the event is recorded. Swept zones receive a score penalty because their liquidity has been partially consumed.
  • Trade Planning Targets: The nearest high-scoring zones above and below current price are highlighted as potential targets, with dashed lines extending forward and score labels.


Zone Scoring System

The scoring system is what separates this indicator from basic liquidity zone tools. Each zone's score is computed from multiple factors:

  • Touch Score (max 60): Each time price touches a zone without sweeping it, the zone gains 12 points. More touches mean more orders have accumulated at that level. Capped at 60 to prevent over-weighting.
  • Freshness (max 40): Newer zones score higher. The freshness component starts at 40 and decays by 0.8 points per bar of age. Old, stale zones that have not been tested lose relevance.
  • Confluence (max 40): Proximity to key institutional levels adds 10 points each. The indicator checks confluence with Prior Day High, Prior Day Low, Prior Week High, Prior Week Low, VWAP, Opening Range High, and Opening Range Low. A zone that aligns with multiple key levels is significantly more important.
  • Reaction Speed (max 22): The ratio of fast reactions (price bouncing within 2 bars of touching the zone) to total reactions. Zones that produce quick, sharp reactions are more likely to hold in the future.
  • Session Alignment: The ratio of RTH (Regular Trading Hours) touches to overnight touches modifies the score. Zones tested during high-liquidity sessions carry more weight.


Score modifiers are then applied:
  • Recently swept zones receive a 0.55x multiplier — their liquidity is partially consumed
  • Midday zones without confluence receive a 0.60x penalty — low-conviction levels
  • Open Drive zones with few touches receive a 0.75x penalty — too early to confirm
  • Power Hour zones with confluence receive a 1.10x boost — high-conviction late-session levels
  • Trend-aligned zones receive a 1.05x boost
  • Mean-reversion zones without confluence receive a 0.70x penalty


Regime Detection

The indicator includes its own regime detection engine based on VWAP slope analysis:

  • Trend Up: VWAP slope exceeds the threshold AND price is at or above VWAP — directional momentum is present
  • Trend Down: VWAP slope is below the negative threshold AND price is at or below VWAP
  • Mean Reversion: VWAP slope is flat (within threshold) AND price is within a configurable band of VWAP — range-bound conditions
  • Mixed: Conditions do not clearly fit any category


The regime state feeds into the zone scoring modifiers. In a trending regime, zones aligned with the trend direction receive a boost. In mean-reversion conditions, zones without confluence are penalized because they are less likely to produce clean reactions.

A confidence percentage is calculated for each regime classification, giving traders a sense of how clearly the market fits the detected state.

Sweep Detection and Classification

When price moves through a liquidity zone, the indicator records a sweep event:

  • The sweep bar and price are stored for each zone
  • A "SWEEP" label is placed on the chart with configurable display modes (Off, First Only, Recent Only)
  • Swept zones receive a significant score penalty (0.55x multiplier)
  • A cooldown prevents multiple sweep labels from stacking on adjacent bars
  • The sweep price is tracked separately from the zone price, allowing analysis of how far price extended beyond the zone


Sweeps are important because they represent liquidity being consumed. A zone that has been swept once still has some residual significance (remaining orders), but its primary liquidity pool has been tapped.

Trade Planning Overlays

The indicator identifies the nearest high-scoring zones above and below current price as potential targets:

  • Only zones with scores above a configurable minimum (default 60) qualify as targets
  • Target lines are drawn as dashed lines extending forward by a configurable number of bars
  • Each target line includes a label showing the zone's score percentage
  • This gives traders a clear view of where the nearest significant liquidity sits in each direction


Visual Design

The indicator uses a "Deep Ocean" color theme — bioluminescent aqua, deep ocean blue, coral orange, tidal cyan, kelp green, and pearl white on an abyssal dark background:

  • Zone Boxes: Color reflects directional expectation (continuation vs rejection blend). Opacity adapts to distance from price, age, and score — nearby fresh high-score zones are more visible, distant old low-score zones fade.
  • Border Width: Score-based — zones scoring 80+ get 3px borders, 50+ get 2px, others get 1px
  • Sweep Labels: Coral-colored "SWEEP" labels at the sweep location
  • Target Lines: Dashed lines in bioluminescent aqua (above) and coral (below) with score labels
  • Key Levels: PDH/PDL, PWH/PWL drawn as reference lines with theme-aware colors
  • Opening Range: ORH/ORL lines marking the first N minutes of the session
  • VWAP: Plotted as a reference line for regime context


快照

HUD Dashboard

The real-time HUD displays:

  • Key level prices and distances: PDH, PDL, PDC, PWH, PWL, ORH, ORL
  • Nearest liquidity targets above and below with scores
  • Current regime state with confidence percentage
  • Time-of-day classification (Open Drive, Midday, Power Hour, RTH, Off)
  • Active zone count


Input Parameters

Zone Detection:
  • Pivot Left/Right Bars: Lookback for swing detection (default: 5/3)
  • Max Zones Stored: Maximum tracked zones (default: 20)
  • Zone Padding: Tick-based padding around pivot levels (default: 6)
  • Merge Distance: Tick distance for merging nearby zones (default: 10)
  • Volume Filter: Minimum normalized volume for zone creation (Low/Mid/High)


Zone Scoring:
  • Min Score to Draw: Minimum score for a zone to be visible (default: 25)
  • Max Visible Zones: Limit on simultaneously displayed zones (default: 10)
  • Reaction Window: Bars to check for reaction after touch (default: 6)
  • Reaction Move: Tick threshold for a valid reaction (default: 14)
  • Fast Reaction: Maximum bars for a "fast" reaction classification (default: 2)


Context:
  • VWAP Slope Length: Lookback for regime detection (default: 20)
  • Trend Slope Threshold: Minimum slope for trend classification
  • Mean-Reversion Band: Maximum distance from VWAP for MR classification
  • Time-of-Day periods: Open Drive, Midday, Power Hour boundaries


Trade Planning:
  • Min Score for Targets: Minimum zone score to qualify as a target (default: 60)
  • Extend Bars: How far forward target lines extend (default: 200)


How to Use This Indicator

Step 1: Identify High-Score Zones
Focus on zones with scores above 60. These have multiple touches, are relatively fresh, and have confluence with key levels. They represent the most significant liquidity pools.

Step 2: Check the Regime
In a trending regime, liquidity zones in the trend direction are more likely to be swept (taken out) as price reaches for stops. In mean-reversion conditions, zones are more likely to produce bounces.

Step 3: Use Targets for Trade Planning
The trade planning lines show you where the nearest significant liquidity sits. In a long trade, the target above is your potential take-profit area. The target below is where your stop might be hunted.

Step 4: Watch for Sweeps
When a zone is swept, its liquidity has been consumed. This often precedes a reversal as the institutional objective (filling orders) has been achieved. A sweep at a high-score zone with confluence is a particularly strong reversal signal.

Step 5: Monitor Zone Lifecycle
Zones are born, tested, and eventually swept or aged out. Fresh zones with rising touch counts are gaining significance. Old zones with no recent touches are losing relevance. The scoring system handles this automatically.

Best Practices

  • Liquidity analysis works best on instruments with reliable volume data and sufficient market depth
  • Higher-timeframe zones (1H, 4H) tend to be more significant than lower-timeframe zones
  • Zones with confluence (near PDH/PDL, PWH/PWL, VWAP) are significantly more reliable than isolated zones
  • Not all sweeps lead to reversals — sometimes price sweeps through and continues. Confirm with other analysis.
  • The regime detection helps contextualize zones but is not infallible. Use it as one input among many.
  • Adjust the volume filter based on your instrument. Highly liquid instruments may need "High" to filter noise. Less liquid instruments may need "Low" to detect zones at all.
  • The merge distance should be calibrated to your instrument's typical spread and tick size


Limitations

  • Pivot-based zone detection has an inherent delay equal to the right-bar lookback period
  • The scoring system uses heuristics, not a statistical model. Scores indicate relative importance, not probability.
  • Volume-based filtering requires reliable volume data. Forex volume from most brokers represents tick volume, not true exchange volume.
  • Zone merging can occasionally combine zones that a manual analyst would keep separate
  • The indicator tracks a maximum number of zones. In very active markets, older zones may be pruned before they are swept.
  • Sweep detection is based on price crossing through the zone boundary. It does not distinguish between genuine institutional sweeps and random price fluctuations through a level.
  • Time-of-day and session features are most relevant for instruments with clear session structures (equities, futures). 24-hour markets like crypto may benefit less from session-based scoring.


Technical Implementation

Built with Pine Script v6 using:
  • 16 parallel arrays for comprehensive zone data tracking (price, type, touches, scores, reactions, etc.)
  • Zone merging algorithm that consolidates nearby pivots into single liquidity pools
  • Multi-factor scoring function with session, regime, and time-of-day modifiers
  • Distance-based and age-based visual fading for clean chart presentation
  • Score-based border width for visual hierarchy
  • Directional expectation coloring (continuation vs rejection blend)
  • VWAP slope-based regime detection with confidence calculation
  • Trade planning line management with score-filtered target identification
  • Sweep tracking with cooldown and configurable display modes
  • Alert conditions for sweeps, regime changes, and high-score zone creation


Originality Statement

This indicator is original in its comprehensive liquidity zone lifecycle management. While pivot-based zone detection exists in other scripts, this indicator is justified because:

  • The multi-factor scoring system (touches, freshness, confluence, reaction speed, session alignment, regime modifiers) provides a quantified assessment of zone significance not available in basic zone indicators
  • Zone merging prevents the visual clutter of overlapping zones at similar price levels
  • Sweep tracking with score penalties creates a dynamic zone lifecycle — zones are born, tested, scored, swept, and aged out
  • Regime-aware scoring modifiers adjust zone significance based on current market conditions
  • Time-of-day integration (Open Drive, Midday, Power Hour) reflects the reality that liquidity behavior changes throughout the trading session
  • Trade planning overlays with score-filtered targets provide actionable forward-looking information
  • The Deep Ocean theme provides intuitive visual hierarchy where zone importance is immediately apparent from color intensity and border width


Disclaimer

This indicator is provided for educational and informational purposes only. It is not financial advice or a recommendation to buy or sell any financial instrument. Liquidity zone analysis identifies areas of probable order concentration based on historical price behavior — it does not predict future price movement. Zones can be swept without reversing, and high-score zones can fail. Past liquidity patterns do not guarantee future behavior. Always use proper risk management and never risk more than you can afford to lose. The author is not responsible for any losses incurred from using this indicator.

-Made by officialjackofalltrades

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。