Isolated Scroll Container

1. Description FVG Engine Strategy

Detects, ranks, and displays the highest-quality Fair Value Gap zones on the chart using a dynamic scoring system

1.1 Indicator Concept

A Fair Value Gap (FVG) — also called a price imbalance — is a concept rooted in Smart Money Concept (SMC) theory. The core idea: when price moves too fast and too aggressively in one direction, it leaves a gap on the chart (a void between two candles) where no actual trading took place. The market tends to return and fill that gap later, as if correcting the supply/demand imbalance it created.

This indicator goes further: instead of plotting every FVG that appears (which floods the chart with colored boxes), it scores the quality of each FVG zone based on four factors — gap size, trading volume, trend alignment, and candle strength — then only displays the highest-scoring zones. That is why the word "Ranked" appears in the indicator's name.

The core belief: Not all FVGs are equal — a gap formed during high volume, a clear trend, and a strong breakout candle is far more reliable than one formed under ordinary conditions.

1.2 Indicator Features

  • FVG Zone Boxes: Each FVG is drawn as a rectangle — teal/green for bullish zones and pink/red for bearish zones — extending to the right so they remain visible over time.
  • Bull/Bear Strength Bars inside each box: Every FVG box is split vertically — the upper half shows a bear strength bar, the lower half shows a bull strength bar — each displaying its percentage (e.g. 73% bull / 27% bear).
  • Smart Text Label: Each box displays a plain-language assessment such as "Strong Bullish Imbalance", "Bearish Bias", or "Weak Bullish (Bear Pressure)" for a quick read of zone quality.
  • Ranking & Filtering: Only the top maxZones zones (default 10) by score are visible at any time. Lower-ranked zones are hidden (not deleted) until their score improves.
  • Alerts (6 types): Triggered when a new FVG forms, when an FVG reaches the top rank, when price touches a zone, and when a zone is fully mitigated.

1.3 How to Use the Indicator

  • Identify potential support and resistance zones: Teal FVG boxes below current price are potential support areas (price may return to fill them). Pink/red boxes above price are potential resistance areas.
  • Prioritize high-ranked zones: Since only the top maxZones zones are shown, any visible box has already passed the quality filter. Zones that remain displayed across many bars without being mitigated — and keep their top-N ranking — are the most significant.
  • Read the text label for directional bias: "Strong Bullish Imbalance" → strong buy zone, expect a bounce when price revisits. "Weak Bullish (Bear Pressure)" → even though it is a bullish FVG, selling pressure dominates — be cautious going long.
  • Watch the bull/bear percentage bars for internal strength: If a bullish FVG box shows a bear bar above 60%, the zone is weakening — the long signal is less reliable.
  • Use the "Bullish/Bearish FVG Touch" alert to catch entries when price pulls back to test an FVG zone, combined with price action confirmation or another indicator.
  • Use the "FVG Fully Mitigated" alert to know when a zone has been completely filled and removed — time to update your support/resistance map.

1.4 How the Indicator Works

Inputs & Their Roles
  • maxZones (Integer, default 10, range 1–20): How many top-ranked FVG zones are displayed on the chart. The indicator stores more internally but only colors and labels the top N. Reducing to 3 shows only the 3 strongest; increasing to 20 includes weaker zones as well.
  • maxStored (Integer, default 50, range 10–200): Maximum number of FVGs kept in memory at once. When exceeded, the lowest-ranked zone is permanently deleted. Higher values allow tracking older historical zones at the cost of more resources.
  • volLength (Integer, default 20): The lookback period for the Volume SMA used as a baseline. If the candle forming the FVG has volume twice the 20-bar average, volScore = 2.0, adding significant points. Lowering to 5 makes the baseline shorter and easier to beat.
  • trendLength (Integer, default 50): The EMA period used for trend alignment. If price closes above EMA-50 when a bullish FVG forms → trend is aligned → trendScore = 1.0 → +20 points. A shorter value (e.g. 20) reacts more to short-term trend direction.
  • showBars (Checkbox, default on): Toggles the bull/bear strength bars inside each FVG box. Turning off keeps the chart cleaner.
  • showBlockText (Checkbox, default on): Toggles the smart text label ("Strong Bullish Imbalance", etc.) inside each FVG box.
  • strengthTextSize / blockTextSize (Options: auto/tiny/small/normal/large/huge): Controls the font size of the percentage labels and the block text label respectively.
  • bullColor / bearColor (Color): Fill color for bullish and bearish FVG boxes and strength bars. Default is teal for bull and pink/red for bear.
  • alertNewBull / alertNewBear / alertTopRank / alertBullTouch / alertBearTouch / alertFullyMitigated (Checkboxes): Enable or disable each of the 6 alert types independently.
Main Logic Blocks

🔷 Flow 1 – FVG Detection (3-candle pattern)

On every new bar, the indicator checks for a 3-candle imbalance pattern:

  • Bullish FVG: low[0] > high[2] — The current candle's low is above the high of the candle 2 bars ago. The gap between those two candles is a bullish FVG. Example: candle[2] has high = 100, current candle has low = 102 → the zone from 100 to 102 is a bullish FVG.
  • Bearish FVG: high[0] < low[2] — The current candle's high is below the low of the candle 2 bars ago. Example: candle[2] has low = 100, current candle has high = 98 → the zone from 98 to 100 is a bearish FVG.

The middle candle (bar[1]) is the strong breakout candle. Candle[2] and candle[0] define the upper and lower boundaries of the FVG zone.

🔷 Flow 2 – Quality Score Calculation

When a new FVG is detected, its initial quality score is calculated immediately:

qualityScore = fvgSize × 100 + volScore × 10 + trendScore × 20 − mitigation × 50
mitigation = 0.0 when freshly created. The score also decays by age × 0.1 on every subsequent bar.
ComponentCalculationMeaning
fvgSize × 100 Gap width in price units × 100 Wider gap = stronger breakout = higher score
volScore × 10 volume / volumeMA. If volume is 2× the average → volScore = 2.0 → +20 pts High volume confirms the validity of the imbalance
trendScore × 20 = 1.0 if FVG aligns with EMA trend direction, = 0.0 if against Trend-aligned FVGs are more reliable than counter-trend ones
− mitigation × 50 Fraction of zone already filled (0.0 to 1.0) Partially filled zones lose score — their reliability decreases
− age × 0.1 Number of bars elapsed since the FVG was created Older untested zones gradually decay in score over time

🔷 Flow 3 – Bull/Bear Strength Score

Alongside the quality score, a composite strength score (0–100) is calculated to split the bull/bear bars:

ComponentMax PointsCalculation
Gap Strength 40 pts fvgSize relative to ATR(14), capped at 2× ATR for full score
Volume Strength 30 pts volScore capped at 2.0 — volume twice the average earns max points
Trend Strength 20 pts trendScore × 20 — binary: 0 or 20 depending on EMA alignment
Candle Strength 10 pts Body-to-range ratio × 10 — a full marubozu candle earns ~10 pts

The total (0–100) is mainStrength. It is then split:

  • For a bullish FVG: bullStrength = mainStrength, bearStrength = 100 − mainStrength
  • For a bearish FVG: bearStrength = mainStrength, bullStrength = 100 − mainStrength

Example: a bullish FVG with mainStrength = 73 → bullStrength = 73%, bearStrength = 27%.

🔷 Flow 4 – Mitigation Tracking

On every bar, the indicator loops through all stored FVGs and checks if price has entered the zone:

  • Bullish FVG is touched when: low <= fvg.top (current bar's low enters the zone from above)
  • Bearish FVG is touched when: high >= fvg.bottom (current bar's high enters the zone from below)

When touched, the fill ratio is calculated. Example: bullish FVG from 100 to 105 (width = 5 pts). Price low reaches 102 → fillDistance = 105 − 102 = 3 → mitigation = 3/5 = 0.6 (60%). When mitigation reaches 1.0 (100%), the zone is permanently deleted from the chart and memory.

🔷 Flow 5 – Sorting, Filtering & Display

After all updates, the full FVG list is sorted descending by qualityScore. Then:

  • If stored count exceeds maxStored: the lowest-ranked zone is popped from memory permanently
  • Each zone is rendered by rank: index < maxZones → shown fully colored; index ≥ maxZones → rendered fully transparent (hidden, not deleted)

🔷 Flow 6 – Smart Text Label Logic

For each visible FVG, the text label is chosen according to the following rules:

FVG TypeConditionLabel Displayed
Bearish FVGbearStrength ≥ 70Strong Bearish Imbalance
bearStrength ≥ 55Bearish Bias
bullStrength > bearStrengthWeak Bearish (Bull Pressure)
OtherwiseNeutral Bearish
Bullish FVGbullStrength ≥ 70Strong Bullish Imbalance
bullStrength ≥ 55Bullish Bias
bearStrength > bullStrengthWeak Bullish (Bear Pressure)
OtherwiseNeutral Bullish
Outputs & Their Role in Trading
  • FVG Zone Boxes: Colored rectangles extending 25 bars to the right. Teal = bullish (potential support), Pink/Red = bearish (potential resistance).
  • Bull/Bear Strength Bars: Two horizontal bars inside each box showing percentage for each side. Bull bar in the lower half, bear bar in the upper half. Bar width scales with the percentage.
  • Smart Text Label: A plain-text string in the right corner of the FVG box — Strong / Bias / Weak / Neutral — for instant readability without needing to look at the percentages.
  • 6 Alert Types: New Bullish FVG, New Bearish FVG, New Top-Ranked FVG, Bullish FVG Touch, Bearish FVG Touch, FVG Fully Mitigated — each toggled independently.
Zoom/Pan Layered Image
Background Overlay
− +

The indicator above just became a TRADING BOT — 1 AI click

📊Original indicator
→
🤖AI 1-click convert
→
⚙️Bot trading 24/7