OPEN-SOURCE SCRIPT

Institutional Structure Intelligence Engine [JOAT]

6 012
Institutional Structure Intelligence Engine

Introduction

The Institutional Structure Intelligence Engine is an advanced open-source market structure indicator that combines swing detection, order block analysis, fair value gap (FVG) identification, institutional level tracking, and velocity analysis into a comprehensive structural intelligence system. This indicator helps traders identify where institutional orders are positioned, where price inefficiencies exist, and how market structure is evolving in real-time.

Unlike basic support/resistance indicators that draw static lines, this engine dynamically tracks institutional footprints through order blocks (zones where institutions accumulated or distributed), fair value gaps (price inefficiencies that often get filled), breaker blocks (failed order blocks signaling reversals), and multi-timeframe institutional levels. The indicator is designed for traders who understand that market structure reveals institutional intent and that price gravitates toward areas of institutional interest.

Why This Indicator Exists

This indicator addresses the challenge of identifying institutional positioning in real-time. Institutional traders leave structural footprints that can be detected through systematic analysis. By combining multiple structural methodologies, this indicator reveals:

  • Order Block Detection: Identifies zones where institutions accumulated or distributed positions before major moves
  • Fair Value Gaps: Detects price inefficiencies where rapid institutional movement left unfilled gaps
  • Breaker Blocks: Tracks failed order blocks that signal potential trend reversals
  • Institutional Levels: Monitors Weekly/Daily highs and lows, Premium/Discount zones, and Golden Zone (0.618-0.5 Fibonacci)
  • Structure Velocity: Measures how quickly market structure is forming to identify momentum shifts
  • Compression Zones: Detects periods of range compression that often precede explosive moves


Each component provides a different structural perspective. Order blocks show where institutions positioned, FVGs show where price moved inefficiently, breaker blocks show where structure failed, institutional levels show key reference points, velocity shows momentum, and compression zones show coiling energy. Together, they create a comprehensive structural intelligence system.

Below showing the Main Features and how it works:

Snapshot

Core Components Explained

1. Advanced Order Block Detection

Order blocks are identified using strict volume and price action criteria:

Bullish Order Block:
Pine Script®
// Two consecutive down candles followed by strong up move if close[2] < open[2] and close[1] < open[1] and close > open and volume[1] > avgVolume * obVolumeThreshold and close > high[1] and (high[1] - low[1]) <= atr * maxATRMult and (close - open) > atr * 0.5


Bearish Order Block:
Pine Script®
// Two consecutive up candles followed by strong down move if close[2] > open[2] and close[1] > open[1] and close < open and volume[1] > avgVolume * obVolumeThreshold and close < low[1] and (high[1] - low[1]) <= atr * maxATRMult and (open - close) > atr * 0.5


Order blocks represent the last opposite-direction move before a strong impulse. The logic: institutions accumulate/distribute in the opposite direction before pushing price in their intended direction. The indicator tracks:
  • Order block volume (total volume during formation)
  • Number of touches (how many times price returned to the zone)
  • Zone strength (calculated from volume, touches, and age)
  • Breaker status (whether the order block was invalidated)


Overlapping Order Block Combination:
When multiple order blocks overlap, the indicator combines them into a single stronger zone:
Pine Script®
if doOBsOverlap(ob1, ob2) ob1.top := math.max(ob1.top, ob2.top) ob1.bottom := math.min(ob1.bottom, ob2.bottom) ob1.obVolume += ob2.obVolume ob1.touches += ob2.touches ob1.strength := math.max(ob1.strength, ob2.strength)


This prevents chart clutter and highlights the most significant institutional zones.

2. Breaker Block Detection

Breaker blocks are order blocks that failed - price broke through them instead of bouncing. This signals potential trend reversal:

Pine Script®
// Bullish OB becomes breaker if price breaks below if low < ob.bottom ob.breaker := true ob.breakTime := time // Bearish OB becomes breaker if price breaks above if high > ob.top ob.breaker := true ob.breakTime := time


Breaker blocks are displayed with distinct colors (cyan for bullish breakers, orange for bearish breakers) to differentiate them from active order blocks. When an order block becomes a breaker, it often signals that institutional positioning has changed and the previous structure is no longer valid.

3. Fair Value Gap (FVG) Detection

FVGs are identified using strict gap and volume criteria:

Bullish FVG:
Pine Script®
// Gap between 2 bars ago high and current low bool bullishFVGDetected = low > high[2] and (low - high[2]) > atr * 0.3 and // Minimum gap size volume > avgVolume * 0.8 // Volume confirmation


Bearish FVG:
Pine Script®
// Gap between 2 bars ago low and current high bool bearishFVGDetected = high < low[2] and (low[2] - high) > atr * 0.3 and // Minimum gap size volume > avgVolume * 0.8 // Volume confirmation


FVGs represent price inefficiencies where institutional orders moved price so quickly that normal auction process was bypassed. These gaps often get "filled" as price returns to establish fair value. The indicator tracks:
  • FVG top and bottom prices
  • Mitigation status (whether the gap has been filled)
  • Mitigation bar (when the gap was filled)


Only non-mitigated FVGs are displayed to keep charts clean. Maximum FVG count is customizable (default: 3) to prevent clutter.

Showing Order Block, Breaker Block, and All Combined OB's that occured:

Snapshot

4. Institutional Level Tracking

The indicator monitors key institutional reference levels:

Weekly High/Low:
Pine Script®
float lastWeekHigh = request.security(syminfo.tickerid, "W", high[1]) float lastWeekLow = request.security(syminfo.tickerid, "W", low[1])


Daily High/Low:
Pine Script®
float yesterdayHigh = request.security(syminfo.tickerid, "D", high[1]) float yesterdayLow = request.security(syminfo.tickerid, "D", low[1])


Premium/Discount Zones:
Based on weekly range:
  • Premium Zone: 70%-100% of weekly range (institutional selling zone)
  • Discount Zone: 0%-30% of weekly range (institutional buying zone)
  • Golden Zone: 50%-61.8% of weekly range (optimal entry zone)


Pine Script®
float weekRange = lastWeekHigh - lastWeekLow float premiumTop = lastWeekHigh float premiumBot = lastWeekLow + (weekRange * 0.7) float discountTop = lastWeekLow + (weekRange * 0.3) float discountBot = lastWeekLow float goldenTop = lastWeekLow + (weekRange * 0.618) float goldenBot = lastWeekLow + (weekRange * 0.5)


These zones help traders identify where institutions are likely to buy (discount) or sell (premium), with the golden zone representing optimal risk:reward entries.

Breaker Block with VOL, Discount zone touched for signal, Market Phase + Quality of chart score:

Snapshot

5. Structure Velocity Analysis

The indicator measures how quickly market structure is forming:

Pine Script®
// Price velocity priceVelocity = ta.change(close, velocityLength) / velocityLength velocityMA = ta.sma(math.abs(priceVelocity), velocityLength) velocityScore = velocityMA > 0 ? math.abs(priceVelocity) / velocityMA : 0 // Volume momentum volumeMomentum = volume / avgVolume volumeAcceleration = ta.change(volumeMomentum, 5) // Structure velocity (how fast structure is forming) structureVelocity = (bar_index - lastSwingHighBar) + (bar_index - lastSwingLowBar)


High velocity indicates rapid structure formation (trending market), low velocity indicates slow structure formation (ranging market). Velocity analysis helps traders identify momentum shifts before they become obvious in price.

6. Compression to Expansion Detection

The indicator detects periods of range compression using strict criteria:

Pine Script®
float rangeMA = ta.sma(high - low, 50) float currentRange = high - low bool compressed = currentRange < rangeMA * 0.3 and volume < avgVolume * 0.8 bool expanding = currentRange > rangeMA * 2.0 and volume > avgVolume * 1.3


Compression zones are only displayed if:
  • Compression lasted at least 10 bars
  • Range is less than 1.5x ATR (truly tight)


This prevents false compression signals and highlights only significant coiling periods that often precede explosive moves.

7. Swing Point Detection

The indicator uses pivot-based swing detection:

Pine Script®
pivotHigh = ta.pivothigh(high, swingLength, swingLength) pivotLow = ta.pivotlow(low, swingLength, swingLength)


Swing points are stored in arrays and used for:
  • Structure line drawing
  • Break of Structure (BOS) detection
  • Change of Character (CHOCH) detection
  • Trend determination


Swing length is customizable (default: 10) to adjust sensitivity.

Visual Elements

  • Order Block Boxes: Filled boxes showing bullish (green) and bearish (red) order blocks with volume and touch count
  • Breaker Block Boxes: Distinct colored boxes (cyan/orange) showing failed order blocks
  • FVG Boxes: Transparent boxes showing bullish (green) and bearish (red) fair value gaps
  • Institutional Lines: Weekly high/low (purple), Daily high/low (yellow)
  • Premium/Discount Fills: Shaded zones showing premium (red), discount (green), and golden (orange) zones
  • Compression Boxes: Purple boxes showing range compression periods
  • Swing Points: Triangle markers showing swing highs (red) and swing lows (green)


All visual elements use "locked" boxes that don't extend indefinitely, preventing chart clutter. Overlap prevention logic ensures boxes don't stack on top of each other.

Input Parameters

Structure Detection:
  • Swing Length: Period for pivot detection (default: 10, range: 3-50)
  • Show Swing Points: Toggle swing markers (default: enabled)
  • Show Structure Lines: Toggle structure lines (default: enabled)
  • Show Compression Zones: Toggle compression boxes (default: disabled to reduce clutter)


Order Blocks:
  • Show Order Blocks: Toggle order block boxes (default: enabled)
  • Combine Overlapping OBs: Merge overlapping order blocks (default: enabled)
  • Show Breaker Blocks: Toggle breaker block display (default: enabled)
  • Volume Threshold: Minimum volume multiplier for OB detection (default: 1.5)
  • Max Order Blocks: Maximum OBs to display (default: 3, range: 1-10)
  • Max ATR Multiplier: Maximum OB size relative to ATR (default: 2.5)


Market Structure:
  • Show Break of Structure: Toggle BOS markers (default: disabled to reduce clutter)
  • Show Change of Character: Toggle CHOCH markers (default: enabled)
  • Show Fair Value Gaps: Toggle FVG boxes (default: enabled)
  • Show FVG Mitigation: Track when FVGs are filled (default: enabled)
  • Max FVGs to Display: Maximum FVGs to show (default: 3, range: 1-10)


Institutional Levels:
  • Show Weekly High/Low: Toggle weekly levels (default: enabled)
  • Show Daily High/Low: Toggle daily levels (default: enabled)
  • Show Golden Zone: Toggle 0.618-0.5 Fib zone (default: enabled)
  • Show Premium/Discount Zones: Toggle institutional zones (default: enabled)


Velocity Analysis:
  • Show Structure Velocity: Toggle velocity calculations (default: enabled)
  • Velocity Period: Period for velocity analysis (default: 20, range: 5-50)


Display:
  • Table Position: Dashboard location (Top Right/Top Left/Bottom Right/Bottom Left)
  • Show Structure Quality Score: Toggle quality metrics (default: enabled)


Colors:
All colors are fully customizable including bullish/bearish structure, order blocks, breaker blocks, FVGs, weekly/daily levels, golden zone, premium/discount zones, and compression zones.

4HR TF BTCUSDT showing the zones being used in action and price movement:

Snapshot

How to Use This Indicator

Step 1: Identify Key Institutional Zones
Look for order blocks with high touch counts and strong volume. These represent areas where institutions are likely to defend their positions.

Step 2: Monitor Fair Value Gaps
FVGs often get filled as price returns to establish fair value. Look for entries when price approaches unfilled FVGs, especially if they align with order blocks.

Step 3: Watch for Breaker Blocks
When an order block becomes a breaker, it signals that institutional positioning has changed. This often marks trend reversals or significant structure shifts.

Step 4: Use Premium/Discount Zones
Look for long entries in discount zones (0-30% of range) and short entries in premium zones (70-100% of range). The golden zone (50-61.8%) offers optimal risk:reward.

Step 5: Check Institutional Levels
Weekly and daily highs/lows act as magnets for price. Breaks above/below these levels often lead to significant moves.

Step 6: Monitor Structure Velocity
High velocity indicates trending conditions (follow the trend), low velocity indicates ranging conditions (fade extremes).

Step 7: Wait for Compression Breakouts
Compression zones mark periods of coiling energy. Breakouts from compression often lead to explosive moves with strong follow-through.

Best Practices

  • Use on 15-minute to 4-hour timeframes for optimal structure clarity
  • Combine order blocks with FVGs for high-probability entries
  • Wait for price to return to order blocks before entering - don't chase
  • Breaker blocks often become new support/resistance in opposite direction
  • Premium/discount zones work best in trending markets
  • Golden zone entries offer best risk:reward when combined with order blocks
  • Compression zones require patience - wait for confirmed breakout
  • Structure velocity helps determine whether to trade with trend or fade extremes
  • Multiple touches on an order block increase its significance
  • FVG fills often provide excellent entry opportunities with tight stops


Indicator Limitations

  • Order blocks don't always hold - institutions can change positioning
  • FVGs don't always get filled - some gaps persist indefinitely
  • Breaker blocks can fail - price can return above/below breaker zones
  • Premium/discount zones are relative to recent range - not absolute levels
  • Compression detection requires sufficient bars - may not work on new instruments
  • Structure velocity is a lagging indicator - confirms moves after they start
  • Maximum box/line limits (500 each) can be reached on lower timeframes with long history
  • Overlap prevention may hide some valid order blocks to prevent clutter
  • The indicator shows structure, not direction - requires trader interpretation
  • Works best on liquid instruments with clear institutional participation


Technical Implementation

Built with Pine Script v6 using:
  • Custom type definitions for OrderBlockInfo and FVGInfo
  • Array-based storage for order blocks, FVGs, and swing points
  • Strict volume and ATR-based filtering for accuracy
  • Overlap detection and combination logic for order blocks
  • Breaker block tracking with time-based invalidation
  • FVG mitigation detection
  • Multi-timeframe security requests for institutional levels
  • Fibonacci-based premium/discount zone calculations
  • Velocity and momentum analysis
  • Compression detection with strict criteria
  • Dynamic box and label management with anti-overlap logic


The code is fully open-source and can be modified to suit individual trading styles and preferences.

Originality Statement

This indicator is original in its comprehensive structural integration. While individual components (order blocks, FVGs, institutional levels) are established concepts, this indicator is justified because:

  • It combines seven distinct structural methodologies into a unified intelligence system
  • Order block detection uses strict multi-criteria filtering (volume, ATR, price action) for accuracy
  • Automatic order block combination prevents clutter while highlighting strongest zones
  • Breaker block tracking provides reversal signals not available in basic order block indicators
  • FVG detection includes mitigation tracking and strict size/volume filtering
  • Premium/discount zones integrate Fibonacci analysis with institutional levels
  • Structure velocity analysis provides momentum context for structural zones
  • Compression detection uses strict criteria to identify only significant coiling periods
  • Anti-overlap logic ensures clean charts without sacrificing information


Each component contributes unique structural intelligence: order blocks show institutional positioning, FVGs show inefficiencies, breaker blocks show failures, institutional levels show reference points, velocity shows momentum, and compression shows coiling energy. The indicator's value lies in presenting these complementary structural perspectives simultaneously with intelligent filtering and display 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. Trading involves substantial risk of loss and is not suitable for all investors.

Market structure analysis is a tool for understanding institutional positioning, not a crystal ball for predicting future price movement. Order blocks, FVGs, and institutional levels do not guarantee profitable trades. Past structural patterns do not guarantee future structural patterns. Market conditions change, and strategies that worked historically may not work in the future.

The zones and levels displayed are mathematical calculations based on current market data, not predictions of future price movement. High-quality order blocks, unfilled FVGs, and premium/discount zones 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

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.