OPEN-SOURCE SCRIPT

FVG Prime (Fair Value Gap Prime)

393
FVG Prime — Fair Value Gap Suite is a professional Fair Value Gap (FVG) analysis tool designed for traders who use Smart Money Concepts (SMC), ICT concepts, and institutional price action.

The indicator automatically detects bullish and bearish Fair Value Gaps using a strict three-candle imbalance model and provides advanced visualization, mitigation tracking, and optional Buy/Sell signals.

Rather than plotting every imbalance indiscriminately, FVG Prime incorporates multiple filtering and confirmation techniques to help reduce market noise while keeping the chart clean and easy to interpret.

The indicator is suitable for:

• Smart Money Concepts (SMC)

• ICT Methodology

• Price Action Trading

• Swing Trading

• Intraday Trading

• Scalping

• Trend Following

• Pullback Entries

• Market Structure Analysis

The primary objective of the indicator is to identify institutional price imbalances and monitor how price reacts when revisiting those zones. It is designed as a decision-support tool and should always be used alongside proper market structure analysis, risk management, and personal trading rules.

USER INPUTS

1️⃣ FVG Detection Settings

Show Bullish FVG (Default: Enabled)

Displays all detected bullish Fair Value Gaps on the chart. Disable this option if you only want to analyze bearish imbalances.

Show Bearish FVG (Default: Enabled)

Displays all detected bearish Fair Value Gaps on the chart. Disable this option if you only want to analyze bullish imbalances.

ATR Size Filter (Default: Enabled)

Filters out very small Fair Value Gaps by requiring the gap height to exceed a percentage of the current Average True Range (ATR). This helps eliminate insignificant market noise and focuses on stronger institutional imbalances.

ATR Multiplier (× ATR) (Default: 0.25)

Determines the minimum size required for a Fair Value Gap to be plotted.

Minimum Gap Size = ATR × 0.25

Increasing this value results in fewer but generally stronger Fair Value Gaps, while decreasing it allows smaller gaps to be displayed.

ATR Length (Default: 14)

Defines the lookback period used to calculate the Average True Range for the size filter.

Smaller values respond more quickly to changing volatility, whereas larger values produce smoother filtering.

Maximum Active FVGs (Default: 20)

Limits the number of Fair Value Gaps displayed simultaneously on the chart.

Once this limit is reached, the oldest Fair Value Gap is automatically removed to maintain chart clarity and improve performance.

2️⃣ Mitigation Logic

Mitigation Trigger (Default: Midline (CE))

Defines when a Fair Value Gap is considered mitigated.

Available options include:

Touch

The Fair Value Gap is considered mitigated as soon as price touches any portion of the gap.

Midline (CE)

The Fair Value Gap is considered mitigated once price reaches the Consequent Encroachment (50% midpoint). This is the default setting and follows one of the most commonly used ICT mitigation concepts.

Full Fill

The Fair Value Gap remains active until price completely fills the entire imbalance.

After Mitigation (Default: Keep (Dimmed))

Determines what happens after a Fair Value Gap has been mitigated.

Delete

Completely removes the Fair Value Gap from the chart.

Keep (Dimmed)

Keeps the Fair Value Gap visible while significantly reducing its opacity, allowing traders to review historical mitigations without cluttering the chart.

3️⃣ Signal Engine

Show Buy / Sell Signals (Default: Enabled)

Displays Buy and Sell signals generated when price interacts with a valid Fair Value Gap according to the selected signal logic.

Signal Trigger (Default: Rejection Close)

Determines how trading signals are generated.

First Touch

A signal is generated immediately when price enters the Fair Value Gap.

Rejection Close

A signal is generated only when price enters the Fair Value Gap but closes back in the expected direction. This generally produces fewer but higher-quality trading opportunities and is the default option.

EMA Trend Filter (Default: Enabled)

Restricts signals to the prevailing trend.

Buy signals are only generated when price is above the EMA.

Sell signals are only generated when price is below the EMA.

This filter helps reduce counter-trend trades.

EMA Length (Default: 200)

Specifies the period of the Exponential Moving Average used for trend confirmation.

The default 200-period EMA is widely used as a long-term trend filter across multiple markets.

Volume Filter (Default: Disabled)

Requires the signal candle's trading volume to exceed the average volume before a Buy or Sell signal is generated.

This can help remove weaker reactions that occur on low trading activity.

Volume SMA Length (Default: 20)

Defines the moving average period used to calculate average trading volume.

Volume Multiplier (× Vol) (Default: 1.2)

Specifies how much greater the current candle's volume must be relative to the average volume.

For example, a value of 1.2 means the signal candle must have at least 120% of the average volume before a signal is allowed.

4️⃣ Visual Settings

Bullish Color (Default: Green)

Selects the display color used for bullish Fair Value Gaps.

Bearish Color (Default: Red)

Selects the display color used for bearish Fair Value Gaps.

Box Transparency (Default: 78)

Controls the transparency of all Fair Value Gap boxes.

Lower values make the boxes darker and more visible, while higher values make them increasingly transparent.

Age Fade Effect (Default: Enabled)

Gradually increases the transparency of older Fair Value Gaps, allowing newer institutional imbalances to stand out more clearly.

Fade Speed (Bars) (Default: 60)

Controls how quickly older Fair Value Gaps become more transparent.

Higher values create a slower fading effect, while lower values cause zones to fade more rapidly.

Show Midline (CE) (Default: Enabled)

Displays the Consequent Encroachment (50% midpoint) inside every Fair Value Gap.

Show Border (Default: Enabled)

Displays a border around each Fair Value Gap box to improve visibility.

Extend Right (Bars) (Default: 6)

Determines how many future bars each active Fair Value Gap extends across the chart.

Show FVG Text (Default: Enabled)

Displays "FVG ▲" or "FVG ▼" labels inside each Fair Value Gap for easier identification.

INDICATOR LOGIC

FVG Prime continuously scans confirmed candles using the classic three-candle Fair Value Gap model.

A Bullish Fair Value Gap is created when the current candle's low is above the high of the candle two bars earlier while the middle candle confirms bullish continuation.

A Bearish Fair Value Gap is created when the current candle's high is below the low of the candle two bars earlier while the middle candle confirms bearish continuation.

To reduce false positives, the indicator can optionally filter Fair Value Gaps using an ATR-based minimum size requirement.

Once a valid Fair Value Gap is identified, the indicator automatically:

• Draws the Fair Value Gap as a colored box.

• Calculates and displays the Consequent Encroachment (50% midpoint).

• Extends the zone into future candles.

• Tracks whether the Fair Value Gap remains active or has been mitigated.

• Automatically updates the appearance of mitigated zones.

When enabled, the Signal Engine monitors every active Fair Value Gap and generates Buy or Sell signals whenever price revisits an institutional imbalance according to the selected signal mode.

Additional confirmation can be added using:

• EMA Trend Filter

• Volume Confirmation

• Rejection Close Logic

These optional filters help improve signal quality while allowing traders to adapt the indicator to different market conditions and trading styles.

WHY IT IS UNIQUE

Unlike many Fair Value Gap indicators that simply plot every imbalance, FVG Prime focuses on quality, flexibility, and usability.

Key features include:

• Automatic Fair Value Gap Detection

• ATR-Based Noise Filtering

• Multiple Mitigation Methods

• Consequent Encroachment (CE) Midline

• Automatic Mitigation Tracking

• Intelligent Buy & Sell Signal Engine

• EMA Trend Confirmation

• Optional Volume Confirmation

• Automatic Age-Based Fade Effect

• Fully Customizable Visual Appearance

• Automatic Active FVG Management

• Historical Mitigation Visualization

• Performance Optimized Design

• Beginner Friendly with Advanced Professional Features

The indicator is designed to provide institutional-quality Fair Value Gap analysis while maintaining a clean and organized chart.

HOW USERS CAN BENEFIT FROM IT

FVG Prime can help traders:

• Identify institutional price imbalances automatically.

• Discover high-probability pullback zones.

• Improve trade timing using Fair Value Gap reactions.

• Align entries with the prevailing market trend.

• Filter weaker setups using ATR and Volume confirmation.

• Monitor whether institutional imbalances remain active or have already been mitigated.

• Reduce manual chart analysis by automating Fair Value Gap detection.

• Maintain cleaner charts through automatic zone management.

• Build consistent rule-based trading plans around Fair Value Gaps.

• Improve discipline by relying on objective detection rules instead of subjective chart interpretation.

Whether you trade stocks, forex, cryptocurrencies, commodities, or indices, FVG Prime provides a structured framework for identifying and managing institutional imbalance zones across multiple markets and timeframes.

ALERTS

The indicator includes built-in alert conditions for automated monitoring and trading workflows.

Available alerts include:

• Buy Signal

• Sell Signal

• New Bullish Fair Value Gap

• New Bearish Fair Value Gap

• Bullish Fair Value Gap Mitigated

• Bearish Fair Value Gap Mitigated

These alerts can be used with TradingView Alerts and webhook integrations for notifications or automated execution systems.

DISCLAIMER

This indicator is provided for educational and informational purposes only. It does not provide financial, investment, or trading advice and should not be interpreted as a recommendation to buy or sell any financial instrument. Trading and investing involve substantial risk, and past performance does not guarantee future results. Always conduct your own analysis and apply appropriate risk management before making any trading decisions.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.