OPEN-SOURCE SCRIPT

Smart Money Structure Decoder [JOAT]

14 233
Smart Money Structure Decoder [JOAT]

Introduction

The Smart Money Structure Decoder is an advanced open-source market structure indicator that identifies institutional footprints through Break of Structure (BOS), Change of Character (CHoCH), liquidity sweeps, price imbalances, and points of interest. This indicator transforms raw price action into actionable smart money intelligence, helping traders identify when institutions are accumulating positions, sweeping liquidity, and shifting market structure.

Unlike basic support/resistance indicators that simply mark price levels, this system analyzes market microstructure through pivot detection, liquidity pool tracking, imbalance zone identification, and multi-timeframe bias alignment. The indicator is designed for traders who understand that institutional activity leaves detectable footprints in market structure and that following smart money positioning offers edge in directional trading.

Why This Indicator Exists

This indicator addresses a critical challenge in trading: identifying when institutional players are actively positioning and when they're manipulating price to trigger retail stops before moving in their intended direction. The core innovation lies in systematically detecting smart money concepts:

  • Market Structure Analysis: Identifies Break of Structure (BOS) when price breaks previous highs/lows in trend direction and Change of Character (CHoCH) when price breaks counter-trend, signaling potential reversals
  • Liquidity Sweep Detection: Tracks when price briefly exceeds key levels to trigger stops then reverses, indicating institutional liquidity hunting
  • Price Imbalance Zones: Identifies fair value gaps where price moved too quickly, leaving inefficiencies that often get filled
  • Points of Interest (POI): Marks high-volume reversal zones where institutions likely established positions
  • Multi-Timeframe Bias: Confirms whether higher timeframe trend aligns with current timeframe structure
  • Volume Confirmation: Validates structure breaks and sweeps with volume surge analysis
  • Real-Time Metrics: Tracks cumulative counts of BOS, CHoCH, sweeps, imbalances, and POIs for pattern recognition


Each component reveals different aspects of institutional activity. BOS confirms trend continuation, CHoCH warns of reversals, liquidity sweeps show manipulation, imbalances mark inefficiencies, POIs identify accumulation zones, MTF bias validates conviction, and volume confirms genuine moves versus fakeouts.

cuplikan

Core Components Explained

1. Pivot Detection System

The indicator uses pivot analysis to identify significant highs and lows:

Pivot High = High that is higher than N bars before and N bars after (default N=10)
Pivot Low = Low that is lower than N bars before and N bars after (default N=10)

These pivots represent swing points where price temporarily reversed, marking potential support/resistance levels and liquidity pools. The pivot length parameter controls sensitivity - lower values detect more pivots (more sensitive), higher values detect only major pivots (less sensitive).

The indicator tracks the most recent pivot high and pivot low, along with their bar indices, to establish the current market structure framework.

2. Market Structure Tracking

The indicator maintains persistent structure variables:

Trend Direction: +1 for uptrend, -1 for downtrend, 0 for undefined
Last High: Most recent pivot high price and bar location
Last Low: Most recent pivot low price and bar location

Market structure evolves through two mechanisms:

Break of Structure (BOS):
- In uptrend: New pivot high exceeds previous pivot high (higher high)
- In downtrend: New pivot low breaks below previous pivot low (lower low)
- BOS confirms trend continuation and institutional commitment to direction

Change of Character (CHoCH):
- In uptrend: New pivot low breaks below previous pivot low (lower low in uptrend)
- In downtrend: New pivot high exceeds previous pivot high (higher high in downtrend)
- CHoCH signals potential trend reversal and shift in institutional positioning

The indicator counts cumulative BOS and CHoCH events, allowing traders to assess whether market is trending cleanly (high BOS, low CHoCH) or choppy (high CHoCH, frequent reversals).

3. Liquidity Pool and Sweep Detection

The indicator maintains arrays of liquidity levels (recent pivot highs and lows) and monitors for sweeps:

Liquidity Pool: Array of last 10 pivot prices and their bar locations
Sweep Detection Logic:
- Price exceeds liquidity level (high > level for highs, low < level for lows)
- Close returns below/above the level (close < level for high sweeps, close > level for low sweeps)
- Volume exceeds average volume * threshold (default 1.8x)

Liquidity sweeps are classic institutional manipulation where price briefly triggers stops at obvious levels then reverses. These often mark excellent entry points as institutions have cleared liquidity and can now move price in their intended direction.

The indicator draws dashed lines from the liquidity level to the sweep bar and places labels marking "SWEEP" events. Swept levels are removed from the liquidity array as they've been cleared.

4. Price Imbalance Detection

Imbalances (Fair Value Gaps) occur when price moves so quickly that it leaves gaps in the order book:

Bullish Imbalance:
- Current low > high from 2 bars ago (gap up)
- Gap size > ATR * 0.3 (significant gap, not just noise)

Bearish Imbalance:
- Current high < low from 2 bars ago (gap down)
- Gap size > ATR * 0.3

The indicator draws boxes around imbalance zones extending 10 bars into the future. These zones often act as magnets where price returns to fill the inefficiency. Institutions frequently use imbalances as entry zones, buying into bullish imbalances or selling into bearish imbalances.

Imbalance count tracks cumulative gaps, helping identify instruments or timeframes with frequent inefficient price action versus those with smooth, efficient movement.

5. Points of Interest (POI) Detection

POIs mark zones where institutions likely established significant positions:

POI Criteria:
- Volume > Average Volume * 1.8 (high participation)
- Bar range > ATR * 0.5 (significant price movement)
- Combination suggests institutional activity

The indicator places small labels at POI locations. These zones often provide support/resistance in future price action as institutions defend their positions or add to them.

POI count helps assess institutional activity levels - high POI counts suggest active institutional participation, low counts suggest retail-dominated or low-activity periods.

6. Multi-Timeframe Bias Analysis

The indicator requests close price from a higher timeframe (default 60m) and determines HTF trend:

HTF Trend = HTF Close > HTF Close[1] ? Bullish : Bearish

MTF Alignment = Current Timeframe Trend matches HTF Trend

When MTF is aligned, trades in the trend direction have higher probability as both timeframes agree. When MTF is divergent, caution is warranted as timeframes conflict.

The dashboard displays alignment status (ALIGNED/DIVERGENT) and strength (STRONG/WEAK) based on how clearly both timeframes show directional bias.

7. Volume Analysis and Confirmation

Volume plays a critical role in validating structure:

Average Volume = 20-period SMA of volume
Volume Spike = Current volume > Average * threshold (default 1.8x)

Volume spikes confirm:
- BOS events (genuine institutional commitment)
- CHoCH events (real reversal, not fakeout)
- Liquidity sweeps (institutional participation)
- POI zones (significant positioning)

Low volume structure breaks often fail, while high volume breaks tend to follow through. The indicator uses volume confirmation throughout its detection logic.

8. Comprehensive Metrics Dashboard

The indicator tracks and displays 13 key metrics:

1. Trend: Current market structure direction (BULLISH/BEARISH/NEUTRAL)
2. Structure: Most recent event (BOS/CHoCH/NONE) with count
3. BOS Count: Cumulative break of structure events with status (HIGH/ACTIVE/LOW)
4. CHoCH Count: Cumulative change of character events with status (CHOPPY/ACTIVE/CLEAN)
5. Liquidity: Active liquidity levels count with status (SWEPT/DENSE/NORMAL)
6. Sweeps: Cumulative sweep count with status (ACTIVE/SOME/NONE)
7. Imbalances: Cumulative imbalance count with status (HIGH/ACTIVE/LOW)
8. POI: Points of interest count with status (ACTIVE/MANY/FEW)
9. Volume: Current volume status (SPIKE/HIGH/NORMAL) with ratio
10. Position: Price position in session range (PREMIUM/DISCOUNT/EQUILIBRIUM) with bias
11. Momentum: RSI-based momentum (OVERBOUGHT/OVERSOLD/NEUTRAL) with value
12. MTF: Multi-timeframe alignment (ALIGNED/DIVERGENT) with strength

These metrics provide complete smart money context at a glance, enabling rapid assessment of market structure, institutional activity, and trade setup quality.

9. Price Position Analysis

The indicator calculates price position within the session range:

Session High = Highest high since session start
Session Low = Lowest low since session start
Session Mid = (Session High + Session Low) / 2

Premium Zone = Price > Session Mid + Range * 0.25 (upper 25% of range)
Discount Zone = Price < Session Mid - Range * 0.25 (lower 25% of range)
Equilibrium = Price between premium and discount zones

Smart money concepts suggest:
- Buy in discount zones (institutions accumulating at favorable prices)
- Sell in premium zones (institutions distributing at favorable prices)
- Avoid equilibrium zones (no clear edge)

The dashboard displays current position and suggested bias (BUY/SELL/WAIT).

Visual Elements

  • BOS Signals: Triangle shapes (up for bullish, down for bearish) marking break of structure events
  • CHoCH Signals: Circle shapes marking change of character events
  • Structure Lines: Lines connecting swing points showing market structure evolution
  • Liquidity Sweep Lines: Dashed lines from liquidity level to sweep point with "SWEEP" labels
  • Imbalance Boxes: Semi-transparent boxes highlighting fair value gaps
  • POI Labels: Small labels marking points of interest
  • Structure Break Lines: Horizontal lines marking BOS levels with "BRK" labels
  • Structure Shift Lines: Dashed lines marking CHoCH levels with "SHIFT" labels
  • Order Block Boxes: Boxes highlighting institutional order zones
  • Trend Background: Subtle gradient showing current trend direction
  • Comprehensive Dashboard: 13-row intelligence panel with all smart money metrics


The visual system is designed for clarity - each element has distinct styling to prevent confusion while maintaining professional appearance.

cuplikan

Input Parameters

Core Settings:
  • Pivot Length: Bars before/after for pivot detection (5-30, default 10)
  • ATR Length: Period for ATR calculation (10-30, default 14)
  • Volume Spike Threshold: Multiplier for volume confirmation (1.2-3.0, default 1.8)


Features:
  • Market Structure (BOS/CHoCH): Toggle structure detection (default enabled)
  • Liquidity Sweeps: Toggle sweep detection (default enabled)
  • Price Imbalances: Toggle imbalance zones (default enabled)
  • Points of Interest: Toggle POI detection (default enabled)
  • Multi-Timeframe Bias: Toggle MTF analysis (default enabled)


Multi-Timeframe:
  • Higher Timeframe: HTF for bias analysis (default 60m)


Colors:
All colors are fully customizable including bull primary (neon cyan), bear primary (neon pink), structure break (gold), liquidity sweep (sunset orange), and imbalance zone (neon purple).

How to Use This Indicator

Step 1: Identify Current Market Structure
Check dashboard "TREND" field. BULLISH structure suggests looking for long setups, BEARISH structure suggests short setups. Note the structure status - clean trends show high BOS and low CHoCH counts.

Step 2: Monitor Structure Events
Watch for BOS signals (triangles) confirming trend continuation. These mark optimal trend-following entry points. Watch for CHoCH signals (circles) warning of potential reversals. These suggest reducing positions or preparing for counter-trend trades.

Step 3: Identify Liquidity Sweeps
Liquidity sweep signals (dashed lines with "SWEEP" labels) mark manipulation events. These often provide excellent entry opportunities as institutions have cleared stops and can now move price. Enter in the direction opposite to the sweep (sweep of highs = short setup, sweep of lows = long setup).

Step 4: Use Imbalance Zones
Imbalance boxes mark fair value gaps. Price often returns to fill these zones. Use imbalances as entry zones - buy into bullish imbalances (price returns to gap), sell into bearish imbalances. Unfilled imbalances suggest strong directional conviction.

Step 5: Respect Points of Interest
POI labels mark institutional positioning zones. These often provide support/resistance. Watch for price reactions at POI levels - bounces confirm institutional defense, breaks suggest institutional exit.

Step 6: Assess Price Position
Check dashboard "POSITION" showing PREMIUM/DISCOUNT/EQUILIBRIUM. Smart money concepts suggest buying in discount zones and selling in premium zones. The dashboard provides bias suggestion (BUY/SELL/WAIT).

Step 7: Confirm with MTF Bias
Review "MTF" alignment status. ALIGNED with STRONG rating confirms both timeframes agree on direction. DIVERGENT suggests caution as timeframes conflict. Only take trades when MTF is aligned for highest probability.

Step 8: Validate with Volume
Check "VOLUME" status. Structure breaks and sweeps with SPIKE or HIGH volume are more reliable than those with NORMAL volume. Low volume events often fail.

Best Practices

  • BOS in trend direction with volume confirmation offers highest-probability continuation trades
  • CHoCH signals are most reliable when they occur at extreme price positions (premium/discount zones)
  • Liquidity sweeps at session highs/lows often mark major reversal points
  • Imbalances that remain unfilled for multiple bars suggest strong directional conviction
  • POI zones near key structure levels (previous BOS/CHoCH) are most significant
  • Trade in discount zones for longs, premium zones for shorts for optimal risk/reward
  • MTF alignment is critical - avoid trades when timeframes diverge
  • High CHoCH count (>3) suggests choppy conditions - reduce position size or avoid
  • Clean trends show BOS count > CHoCH count by at least 2:1 ratio
  • Volume spike confirmation separates genuine institutional moves from retail noise
  • Multiple sweeps at same level suggest strong institutional interest
  • Imbalances near structure breaks often get filled before trend continuation


Indicator Limitations

  • Pivot detection requires sufficient bars before/after - signals lag by pivot length
  • Structure analysis works best on liquid instruments with clear swing points
  • Liquidity sweep detection is probabilistic - not all sweeps lead to reversals
  • Imbalance zones can remain unfilled for extended periods during strong trends
  • POI detection uses volume which may be unreliable on some instruments
  • MTF analysis requires data availability on selected higher timeframe
  • The indicator identifies structure but cannot predict institutional intent
  • High-frequency trading and algorithmic activity can create false structure signals
  • News events can override technical structure instantly
  • Structure breaks can be fakeouts - always use stop losses
  • The indicator shows what institutions did, not what they will do


Technical Implementation

Built with Pine Script v6 using:
  • Pivot detection using ta.pivothigh and ta.pivotlow with customizable length
  • Persistent structure tracking using var variables for trend, highs, lows, and bar indices
  • Array-based liquidity pool management with dynamic addition/removal
  • Imbalance detection using gap analysis with ATR-based filtering
  • Volume spike detection using rolling average comparison
  • POI identification combining volume and range analysis
  • Multi-timeframe security request with proper lookahead settings
  • Price position calculation using session high/low tracking
  • RSI-based momentum analysis for overbought/oversold context
  • Comprehensive dashboard with 13 metrics and color-coded status indicators
  • Dynamic line and box drawing for structure visualization
  • Label system with size and style variations for different signal types


The code is fully open-source with detailed comments explaining smart money concepts and detection logic.

Originality Statement

This indicator is original in its comprehensive smart money structure analysis. While individual concepts (BOS, CHoCH, liquidity sweeps, imbalances) are established in smart money trading, this indicator is justified because:

  • It systematically integrates five distinct smart money concepts (structure, sweeps, imbalances, POI, MTF) into a unified detection system
  • The liquidity pool tracking with dynamic sweep detection provides real-time manipulation identification
  • Imbalance zone detection with ATR-based filtering ensures only significant gaps are marked
  • POI detection combines volume and range analysis to identify institutional positioning zones
  • Price position analysis (premium/discount/equilibrium) provides smart money context for entries
  • The comprehensive dashboard synthesizes 13 metrics into unified smart money intelligence
  • Integration of volume confirmation throughout ensures signals reflect genuine institutional activity
  • MTF bias alignment validates that structure aligns across temporal dimensions
  • Cumulative event counting (BOS, CHoCH, sweeps, imbalances, POI) enables pattern recognition
  • The visual system clearly distinguishes between different structure types without clutter


Each component reveals different institutional footprints: BOS shows commitment, CHoCH shows reversal, sweeps show manipulation, imbalances show inefficiency, POI shows positioning, price position shows value zones, MTF shows conviction, and volume confirms participation. The indicator's value lies in combining these complementary perspectives into a cohesive smart money structure analysis system.

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. Trading involves substantial risk of loss and is not suitable for all investors.

Smart money structure analysis is a tool for understanding institutional footprints, not a crystal ball for predicting future price movement. Structure breaks do not guarantee trend continuation. Liquidity sweeps do not guarantee reversals. Past structure patterns do not guarantee future structure patterns. Market conditions change, and strategies that worked historically may not work in the future.

The metrics displayed are mathematical calculations based on current market data, not predictions of future price movement. BOS, CHoCH, sweeps, imbalances, and POI signals do not guarantee profitable trades. Users must conduct their own analysis and risk assessment before making trading decisions.

Always use proper risk management, including stop losses and position sizing appropriate for your account size and risk tolerance. Never risk more than you can afford to lose. Consider consulting with a qualified financial advisor before making investment decisions.

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

-Made with passion by officialjackofalltrades

Pernyataan Penyangkalan

Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.