OPEN-SOURCE SCRIPT

Liquidity Structure Mapper [JOAT]

9 107
Liquidity Structure Mapper

Introduction

The Liquidity Structure Mapper is an advanced market structure analysis tool designed to identify and visualize the key levels where institutional traders place their orders. This indicator goes beyond simple support and resistance by detecting swing points, equal highs/lows, liquidity zones, and the patterns that reveal professional market participation. Understanding market structure and liquidity is fundamental to successful trading - institutions don't enter at random levels, they hunt liquidity at specific price points, and this tool reveals those locations.

This indicator is built for traders who understand that markets are driven by liquidity - the accumulation and distribution of orders at key levels. Whether you're a day trader timing entries at structure, a swing trader identifying major turning points, or a position trader mapping long-term levels, this mapper provides the institutional-grade structural analysis needed to trade with the smart money rather than against it.

スナップショット

Why This Indicator Exists

Most traders draw support and resistance lines arbitrarily or use basic pivot points without understanding the underlying liquidity dynamics. This indicator addresses that limitation by:

  • Swing Point Detection: Identifies true market structure turning points
  • Equal Level Analysis: Finds equal highs and lows that form liquidity pools
  • Liquidity Zone Mapping: Visualizes areas of concentrated order flow
  • Zone Strength Scoring: Quantifies the reliability of each level
  • Sweep Detection: Identifies liquidity grabs before reversals
  • Proximity Analysis: Shows distance to nearest key levels


The mapper transforms abstract market structure concepts into concrete, actionable levels with measurable strength and reliability.

Core Components Explained

1. Swing Point Detection

The indicator identifies true swing points using pivot analysis:

Pine Script®
// Swing point detection float pivot_high = ta.pivothigh(high, i_swing_left, i_swing_right) float pivot_low = ta.pivotlow(low, i_swing_left, i_swing_right) // Process new swing high if not na(pivot_high) and barstate.isconfirmed int pivot_bar = bar_index - i_swing_right SwingPoint new_sh = SwingPoint.new() new_sh.price := pivot_high new_sh.bar_idx := pivot_bar new_sh.direction := 1 new_sh.is_valid := true


Swing features:
  • Left Bars: Bars to the left of pivot (default: 10)
  • Right Bars: Bars to the right for confirmation (default: 5)
  • Validation: Only confirmed swing points are marked
  • Visual Markers: Clear labels showing price and level type
  • Historical Tracking: Maintains history of all swing points


True swing points represent where the market actually changed direction - these are the foundation of market structure.

2. Equal Highs/Lows Detection

The indicator finds equal levels that form liquidity zones:

Pine Script®
f_find_equal_levels(array<SwingPoint> swings, float threshold, int zone_type, color zone_col, float atr_val) => int sz = array.size(swings) if sz >= 2 and barstate.isconfirmed SwingPoint latest = array.get(swings, sz - 1) for i = 0 to sz - 2 SwingPoint compare = array.get(swings, i) if compare.is_valid and latest.is_valid float pct = f_pct_diff(latest.price, compare.price) if pct <= threshold // Found equal level - create liquidity zone float zone_top = math.max(latest.price, compare.price) float zone_bottom = math.min(latest.price, compare.price) // Add ATR buffer to zone zone_top := zone_top + atr_val * 0.1 zone_bottom := zone_bottom - atr_val * 0.1


Equal level features:
  • Threshold: Percentage tolerance for equality (default: 0.1%)
  • Zone Creation: Forms zones around equal levels
  • ATR Buffer: Adds small buffer based on volatility
  • Zone Types: EQH (equal highs) and EQL (equal lows)
  • Liquidity Pools: Areas where stops cluster


Equal highs/lows are where stop losses and pending orders accumulate - they're liquidity magnets.

3. Liquidity Zone Management

The indicator tracks and manages liquidity zones dynamically:

Pine Script®
// Zone interaction tracking if array.size(liq_zones) > 0 and barstate.isconfirmed for i = array.size(liq_zones) - 1 to 0 LiquidityZone zone = array.get(liq_zones, i) if zone.is_active // Check if price swept the zone bool swept_high = zone.zone_type == 1 and high > zone.top bool swept_low = zone.zone_type == -1 and low < zone.bottom // Update zone age zone.age_bars := zone.age_bars + 1 // Check for zone touches bool touching_high = zone.zone_type == 1 and high >= zone.bottom and high <= zone.top bool touching_low = zone.zone_type == -1 and low <= zone.top and low >= zone.bottom if (touching_high or touching_low) and not (swept_high or swept_low) zone.touch_count := zone.touch_count + 1


Zone features:
  • Active Zones: Zones that haven't been swept yet
  • Touch Count: Number of times price has tested the zone
  • Zone Age: How long the zone has existed
  • Sweep Detection: Identifies when liquidity is taken
  • Strength Updates: Zones get stronger with more touches


Zones that are tested multiple times become stronger and more significant.

4. Zone Strength Calculation

Each zone is assigned a strength score:

Pine Script®
f_calc_zone_strength(int touches, int age, float zone_width, float atr_val) => float touch_score = math.min(float(touches) / 5.0 * 40, 40) float age_score = math.max(30 - float(age) / 50.0 * 30, 0) float width_score = math.min(atr_val / zone_width * 30, 30) touch_score + age_score + width_score


Strength components:
  • Touch Score: More touches = stronger level (max 40 points)
  • Age Score: Fresher zones are more relevant (max 30 points)
  • Width Score: Tighter zones are more precise (max 30 points)
  • Total Strength: 0-100 indicating zone reliability
  • Visual Updates: Zone color intensifies with strength


Strength scoring helps prioritize which levels deserve more attention.

5. Structure Analysis Metrics

The indicator calculates structural relationships:

Pine Script®
// Calculate structure metrics float nearest_resistance = na float nearest_support = na // Find nearest resistance above current price if array.size(swing_highs) > 0 for i = array.size(swing_highs) - 1 to 0 SwingPoint sh = array.get(swing_highs, i) if sh.price > close and (na(nearest_resistance) or sh.price < nearest_resistance) nearest_resistance := sh.price // Find nearest support below current price if array.size(swing_lows) > 0 for i = array.size(swing_lows) - 1 to 0 SwingPoint sl = array.get(swing_lows, i) if sl.price < close and (na(nearest_support) or sl.price > nearest_support) nearest_support := sl.price // Structure bias calculation float structure_bias = 0.0 if not na(dist_to_resistance) and not na(dist_to_support) structure_bias := (dist_to_support - dist_to_resistance) / (dist_to_support + dist_to_resistance)


Metrics include:
  • Nearest Resistance: Closest swing high above price
  • Nearest Support: Closest swing low below price
  • Distance Percentages: How far price is from each level
  • Structure Bias: Overall structural directional bias
  • Proximity Score: How close price is to key levels


These metrics provide context for current price position within the structure.

6. Proximity Analysis System

The indicator measures how close price is to key levels:

Pine Script®
f_proximity_score(float price, float zone_top, float zone_bot) => float zone_mid = (zone_top + zone_bot) / 2 float dist = math.abs(price - zone_mid) float zone_height = zone_top - zone_bot math.max(100 - (dist / zone_height * 100), 0) // Dynamic proximity labels if i_show_prox_labels and barstate.islast if not na(nearest_resistance) and resistance_proximity > 30 string res_label = "RESISTANCE\n" + str.tostring(nearest_resistance, "#.##") + "\nProximity: " + str.tostring(resistance_proximity, "#") + "%"


Proximity features:
  • Proximity Score: 0-100% showing closeness to levels
  • Dynamic Labels: Shows level price and proximity
  • Warning System: Alerts when approaching key levels
  • Background Colors: Visual warnings at high proximity
  • Distance Tracking: Real-time distance monitoring


Proximity analysis helps prepare for potential reactions at key levels.

Visual Elements

  • Swing Points: Clear markers for highs and lows with labels
  • Liquidity Zones: Color-coded zones with glow effects
  • Zone Strength: Visual intensity based on reliability
  • Swept Zones: Different styling for taken liquidity
  • Proximity Labels: Dynamic labels showing nearest levels
  • Warning Markers: Visual alerts at key level approaches
  • Dashboard: Comprehensive structure metrics
  • Background Shading: Subtle warnings at critical levels


スナップショット

The dashboard displays:
1. Active EQH and EQL zone counts
2. Nearest support and resistance levels
3. Proximity percentages to key levels
4. Zone strength distribution
5. Structure bias and metrics
6. Recent sweep activity
7. Level age and touch statistics
8. Trading recommendations based on structure

Input Parameters

Swing Detection:
  • Left Bars: Pivot lookback period (default: 10)
  • Right Bars: Confirmation period (default: 5)
  • Max Swings: Maximum swing levels to track (default: 20)
  • Show Swings: Display swing point markers


Equal Levels:
  • Equal Threshold: Percentage tolerance (default: 0.1%)
  • Show EQH/EQL: Display equal high/low zones
  • Zone Extension: How far zones extend (default: 50 bars)


Zone Settings:
  • Show Zones: Display liquidity zones
  • Zone Lookback: Historical zone tracking (default: 100)
  • Min Touches: Minimum touches for strength (default: 2)
  • ATR Buffer: Zone size multiplier (default: 0.15)


Visual Settings:
  • Color Scheme: Customizable colors for all elements
  • Glow Effects: Enable visual enhancements
  • Label Sizes: Adjustable text sizes
  • Dashboard Display: Show/hide metrics panel


How to Use This Indicator

Step 1: Identify Key Structure
Start by identifying major swing highs and lows. These form the foundation of market structure and define the overall market direction.

Step 2: Locate Liquidity Zones
Look for equal highs and lows that form liquidity zones. These are where stop losses accumulate and where institutions often target for liquidity grabs.

Step 3: Assess Zone Strength
Pay attention to zone strength scores. Zones with multiple touches (3+) and high strength (>70%) are more reliable for reactions.

Step 4: Monitor for Sweeps
Watch for price sweeping liquidity zones (breaking slightly beyond levels) and then reversing. These are often reversal signals.

Step 5: Use Proximity Analysis
When price approaches key levels (proximity > 70%), prepare for potential reactions. This is where entries or exits should be considered.

Step 6: Track Structure Bias
The structure bias shows whether price is closer to support or resistance. This can guide your directional bias.

Best Practices

  • The most reliable levels have multiple touches and high strength scores
  • Liquidity grabs (sweeps) often precede strong reversals
  • Fresh zones (newly formed) are often more significant than old ones
  • Combine structure with price action for confirmation
  • Higher timeframe structure overrides lower timeframe levels
  • Zone strength increases with each successful test
  • Be cautious at zones with very wide spreads - they're less precise
  • Watch for clusters of zones - these form major support/resistance areas
  • Keep a structure journal to track which levels hold best
  • Use structure for stop placement - just beyond key levels


4HR TF On BTC:

スナップショット

Trading Applications

Support/Resistance Trading:
  • Enter long near strong support zones
  • Enter short near strong resistance zones
  • Place stops just beyond the zone boundaries
  • Target the opposite zone or midpoint


Breakout Trading:
  • Wait for clear breaks of structure
  • Confirm with volume and momentum
  • Enter on retests of broken levels
  • Use zones as new support/resistance


Reversal Trading:
  • Look for liquidity sweeps beyond zones
  • Enter on first signs of reversal
  • Confirm with candlestick patterns
  • Target the opposite structure level


Strategy Integration

This indicator enhances any trading system:

  • Use structure levels for stop placement
  • Filter trades based on proximity to key levels
  • Time entries at strong support/resistance
  • Identify high-probability reversal zones
  • Export structure metrics for custom logic
  • Combine with trend analysis for optimal results


Technical Implementation

Built with Pine Script v6 featuring:
  • Advanced swing point detection with pivot analysis
  • Equal level identification with customizable thresholds
  • Dynamic liquidity zone management and tracking
  • Zone strength scoring with multiple factors
  • Real-time proximity analysis and warnings
  • Comprehensive structure metrics calculation
  • Visual effects including glow and gradient fills
  • Interactive dashboard with 8 key metrics
  • Alert conditions for all major structural events
  • Export functions for strategy integration


The code uses confirmed bars for all calculations to prevent repainting and ensure reliable structure identification.

Originality Statement

This indicator is original in its comprehensive approach to liquidity structure analysis and zone management. While swing point detection is a known concept, this indicator is justified because:

  • It synthesizes swing analysis with equal level detection to identify liquidity zones
  • The zone strength scoring system provides objective measures of level reliability
  • Dynamic zone management tracks the lifecycle of each liquidity area
  • Proximity analysis adds practical trading context to structure identification
  • Sweep detection identifies the patterns of liquidity grabs
  • The dashboard presents complex structural analysis in an accessible format
  • Visual elements including glow effects and gradients enhance readability
  • Export functions enable integration with any trading system
  • Each component provides unique insights: swing points show structure, equal levels show liquidity, strength shows reliability, and proximity shows opportunity
  • The indicator solves the real problem of identifying where institutions place orders rather than just drawing arbitrary lines


The indicator's value lies in transforming abstract market structure concepts into concrete, actionable levels with measurable properties that traders can use to make informed decisions about entries, exits, and risk management.

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. Market structure analysis is a tool for understanding price levels, not a prediction system.

Support and resistance levels can break without warning due to news events, economic data, or changes in market sentiment. Past reactions at levels do not guarantee future behavior. The indicator's levels are mathematical calculations based on historical price action and should be used in conjunction with other forms of analysis.

Always use proper risk management, including stop losses placed beyond key levels. Never assume a level will hold - always have a plan for when it breaks. Liquidity zones can be swept multiple times before a final reversal.

The author is not responsible for any losses incurred from using this indicator. Users assume full responsibility for all trading decisions made using this system.

-Made with passion by officialjackofalltrades

免責事項

これらの情報および投稿は、TradingViewが提供または承認する金融、投資、取引、またはその他の種類の助言もしくは推奨であることを意図したものではなく、またこれらに該当するものでもありません。詳細は利用規約をご覧ください。