OPEN-SOURCE SCRIPT

Fibonacci Imbalance Zones [JOAT]

10 080
Fibonacci Imbalance Zones

Introduction

Fibonacci Imbalance Zones is an open-source overlay indicator that merges automatic Fibonacci retracement with Fair Value Gap (FVG) detection and order block identification to find high-probability confluence zones where institutional concepts overlap. When a Fibonacci level aligns with an unmitigated FVG or an active order block, the indicator highlights that zone as a confluence point and optionally generates entry signals. It bridges the gap between classical Fibonacci analysis and modern Smart Money Concepts.

Built with Pine Script v6, the indicator uses custom types for Fibonacci levels, FVG zones, confluence points, swing points, order blocks, and institutional levels.

Snapshot

Why This Indicator Exists

Fibonacci retracement and FVG analysis are both widely used, but they are almost always applied as separate tools. Traders manually eyeball whether a Fibonacci level happens to overlap with an FVG, which is subjective and error-prone. This indicator automates that process by:

  • Auto-Fibonacci calculation: Automatically identifies the most recent significant swing high and swing low using pivot detection, then draws Fibonacci levels between them — no manual drawing required
  • FVG lifecycle tracking: Detects bullish and bearish FVGs, filters them by minimum size (ATR-based), tracks mitigation, and classifies them as premium or discount relative to fair value
  • Confluence detection: Programmatically checks whether any active Fibonacci level falls within a configurable ATR tolerance of any unmitigated FVG or order block, and calculates a confluence strength score
  • Entry signal generation: When price enters an FVG zone that overlaps with a key Fibonacci level (0.500-0.786 range), the indicator generates a directional entry signal


Core Components Explained

1. Automatic Fibonacci Levels

The indicator uses pivot detection to find the most significant recent swing high and swing low. The pivot strength parameter (default 5) controls how many bars on each side must be lower/higher for a point to qualify as a swing. Once swings are identified, Fibonacci levels are calculated:

Pine Script®


Standard levels include 0.236, 0.382, 0.500, 0.618, and 0.786, each toggleable independently. Extensions at 1.618 and 2.272 are also available. When harmonic ratios are enabled, additional levels at 0.127, 0.414, 0.707, and 0.886 are drawn, covering the full spectrum of Fibonacci and harmonic trading levels.

Each level is drawn as a dashed line extending from the swing range to the right of the chart, with a label showing the ratio. Harmonic ratios receive a glow effect (thicker line, lower transparency) to visually distinguish them from standard levels.

2. FVG Detection with Premium/Discount Classification

Fair Value Gaps are detected using the standard three-bar pattern: a bullish FVG forms when the current bar's low is above the high from two bars ago. The indicator filters FVGs by a minimum size threshold (default 0.3x ATR) to avoid plotting insignificant gaps.

Each FVG is classified as premium or discount relative to the fair value of the middle candle:

  • Premium FVG: The gap's midpoint is above fair value — sellers may have an edge
  • Discount FVG: The gap's midpoint is below fair value — buyers may have an edge


FVGs are drawn as colored boxes. Premium FVGs use a gold color, discount FVGs use cyan, and neutral FVGs use the standard bull/bear colors. When mitigation tracking is enabled, the indicator monitors each FVG and updates its visual style (dotted border, faded color) when price fills the gap's midpoint.

Chart showing auto-drawn Fibonacci levels between swing high and swing low, with FVG boxes classified as premium (gold) and discount (cyan), and confluence diamonds where Fibonacci levels overlap with FVGs

3. Order Block Detection

The indicator identifies order blocks as the last opposing candle before a significant swing point, filtered by volume. A bullish order block is the last bearish candle before a swing high, but only if the volume on that candle exceeds 1.5x the 20-period volume average. This volume filter ensures that only institutionally significant order blocks are tracked.

Order blocks are drawn as semi-transparent boxes and monitored for sweeps. When price breaks through an order block, it is marked as swept and its visual is updated to a neutral, dotted style.

4. Confluence Detection Engine

The confluence engine is the core innovation of this indicator. It iterates through all active Fibonacci levels and checks each one against all unmitigated FVGs and active order blocks:

Pine Script®


Each confluence point receives a strength score based on how many factors align:
  • Fibonacci level + FVG = base confluence
  • Add +1 if the Fibonacci level is a harmonic ratio (0.382, 0.618, etc.)
  • Add +1 if the FVG is in the premium or discount zone
  • Add +1 if the FVG has above-average volume
  • Add +1 if an order block also overlaps


Confluence points are drawn as labeled boxes showing which factors are present (e.g., "Harmonic+Discount+Volume"). A minimum confluence strength threshold (default 2) filters out weak confluences.

5. Entry Signal Generation

When entry signals are enabled, the indicator generates a bullish entry when price enters a bullish FVG zone that overlaps with a Fibonacci level in the 0.500-0.786 range (the "golden pocket") and the current candle closes bullish. The bearish entry is the inverse. These signals are plotted as circles below (bullish) or above (bearish) the price bars.

Visual Elements

  • Fibonacci Lines: Dashed lines at each active ratio with labels, harmonic ratios get glow effect
  • FVG Boxes: Color-coded by direction and premium/discount status, updated on mitigation
  • Order Block Boxes: Semi-transparent boxes with sweep tracking
  • Confluence Boxes: Highlighted zones where Fibonacci and FVG/OB overlap, with strength labels
  • Entry Signals: Circle markers for bullish/bearish entries at confluence zones
  • Structure Line: Line connecting the swing high and swing low
  • Background Coloring: Subtle trend-direction background tint
  • Dashboard: Displays current Fibonacci range, trend direction, active FVG count, confluence count, and entry status


Input Parameters

Fibonacci Settings:
  • Swing Lookback (default 50) and Pivot Strength (default 5)
  • Toggle each standard level (0.236, 0.382, 0.500, 0.618, 0.786) and extensions


FVG Detection:
  • FVG Max Age (default 50 bars)
  • Track Mitigation toggle
  • Min FVG Size (default 0.3 ATR)


Confluence Settings:
  • Confluence Tolerance (default 0.3 ATR)
  • Show Entry Signals and Confluence Strength
  • Min Confluence Strength (default 2)


Advanced Fibonacci:
  • Show Harmonic Ratios (0.127, 0.414, 0.707, 0.886)
  • Show Institutional Levels (volume-based levels near swings)
  • Show Smart Money Concepts and Order Blocks
  • Show Premium/Discount classification


Visual Settings:
  • Color Scheme: Quantum, Classic, Professional, or Minimal
  • Show Structure Lines, Dashboard, Glow Effects, Animation
  • Max Visual Elements (default 30)


Snapshot

How to Use This Indicator

Step 1: Let the indicator automatically identify the current swing range and draw Fibonacci levels. The structure line shows the swing high to swing low connection.

Step 2: Identify the trend direction from the structure line. In an uptrend (swing low formed after swing high), look for bullish setups at discount Fibonacci levels (0.618, 0.786). In a downtrend, look for bearish setups at premium levels.

Step 3: Watch for confluence diamonds. When a Fibonacci level overlaps with an unmitigated FVG, the confluence box appears. Higher strength confluences (3+) are more significant.

Step 4: If entry signals are enabled, wait for price to enter the confluence zone and print a confirming candle (bullish close for longs, bearish close for shorts).

Step 5: Use order blocks within the confluence zone as precise entry levels. The order block's range provides a natural stop-loss area (below the OB for longs, above for shorts).

Close-up of a high-strength confluence zone showing a 0.618 Fibonacci level overlapping with a discount FVG and a bullish order block, with an entry signal circle below the bar

Indicator Limitations

  • Automatic Fibonacci levels depend on pivot detection, which has an inherent delay. The swing points update only after the pivot is confirmed.
  • Fibonacci levels are drawn between the two most recent significant swings. In choppy markets with many equal swings, the selected range may not be the most relevant one.
  • FVG detection uses the standard three-bar pattern, which can produce many gaps on volatile instruments. Use the minimum size filter to manage this.
  • Confluence detection is proximity-based. A Fibonacci level near an FVG does not guarantee a price reaction — it identifies a zone of potential interest.
  • Entry signals are mechanical and do not account for broader market context. They should be used as alerts for further analysis, not as standalone trade triggers.
  • The indicator draws many visual elements. On busy charts, consider using the Max Visual Elements setting and disabling less critical features.


Originality Statement

This indicator is original in its automated confluence detection between Fibonacci analysis and Smart Money Concepts. While Fibonacci tools and FVG indicators exist separately, this indicator is justified because:

  • It programmatically detects overlap between Fibonacci levels and FVG zones, eliminating subjective visual assessment
  • The confluence strength scoring system quantifies how many institutional factors align at each zone
  • Premium/discount FVG classification adds a fair-value context layer to standard FVG detection
  • Volume-filtered order block detection integrated with Fibonacci levels creates a three-way confluence system
  • Harmonic ratio support extends beyond standard Fibonacci to cover the full spectrum of institutional trading levels
  • The entry signal system combines Fibonacci position, FVG presence, and candle confirmation into a structured trigger


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. Fibonacci levels and FVG analysis are interpretive tools, not predictive guarantees. Always use proper risk management. The author is not responsible for any losses incurred from using this indicator.

-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.