OPEN-SOURCE SCRIPT

FVG Average Analyzer [point algo]

86
Overview
The FVG Average Analyzer is a technical indicator that measures and analyzes Fair Value Gap (FVG) sizes to help traders identify market efficiency and volatility conditions. Unlike traditional FVG indicators that simply mark gap zones on charts, this tool quantifies gap magnitude and compares it against historical averages to reveal market state transitions

What is a Fair Value Gap (FVG)?
A Fair Value Gap occurs when price moves aggressively, creating an imbalance or "inefficiency" in the market. Bullish FVGs form when the current candle's low is higher than the low of two candles prior, while bearish FVGs occur when the current candle's high is lower than the high of two candles back. These gaps represent areas where institutional buying or selling activity caused rapid price displacement, leaving behind liquidity voids that markets may revisit

Key Features
1. Gap Size Quantification
  • Automatically detects both bullish and bearish FVGs using three-candle pattern logic
  • Calculates the exact size of each gap in real-time
  • Color-codes gaps: green for bullish, red for bearish


2. Dynamic Average Calculation
  • Computes a Simple Moving Average (SMA) of FVG sizes over a customizable lookback period (default: 20 bars)
  • Provides context for whether current gaps are above or below historical norms


3. Market State Classification
  • VOLATILE State: Current FVG size exceeds average, indicating aggressive price action and potential trend acceleration
  • EFFICIENT State: Current FVG size below average, suggesting balanced market conditions with reduced inefficiency
  • Mega Gap alerts trigger when FVG size exceeds 2x the average, highlighting extreme displacement events


4. Real-Time Dashboard
  • Displays current gap size with color-coded status
  • Shows rolling average FVG size for trend context
  • Indicates market state (Volatile vs Efficient) for quick assessment


How to Use This Indicator

Volatility Assessment
Monitor the relationship between current FVG size and the average to gauge market conditions. When gaps consistently exceed the average, expect continuation of volatile moves; when gaps shrink below average, anticipate consolidation or ranging behavior.

Confluence with Market Structure
Combine this analyzer with price action tools like order blocks, support/resistance, or trend indicators. Large FVGs (Mega Gaps) often coincide with structural breaks and can signal high-probability entry zones when aligned with trend direction.

Entry Timing
Use the market state classification to time entries: in VOLATILE conditions, wait for retracements into large unfilled gaps; in EFFICIENT markets, focus on range-bound strategies rather than breakout trades.

Multi-Timeframe Analysis
Apply the indicator across different timeframes to identify where FVG inefficiency is concentrated. Higher timeframe volatility signals often provide stronger directional bias for lower timeframe trade execution.

Settings
1. Average Period (SMA): Adjustable lookback period (default: 20) for calculating the average FVG size. Shorter periods react faster to changes; longer periods provide smoother, more stable averages.

2. Significant Multiplier: Threshold for identifying "Mega Gaps" (default: 2.0x average). Adjust based on instrument volatility characteristics.

Technical Implementation
The indicator operates in a separate panel below the main chart (overlay=false), plotting two primary lines: the real-time FVG size (color-coded by direction) and the rolling SMA of gap sizes. Diamond markers appear at the top of the panel when Mega Gaps form, providing visual alerts for extreme conditions.

Best Practices
  1. Works on all markets and timeframes (forex, crypto, stocks, indices)
  2. Most effective when combined with volume analysis and ATR-based volatility filters
  3. Use higher threshold multipliers (2.5-3.0x) for ranging markets; lower values (1.5-2.0x) for trending markets
  4. Monitor the dashboard for quick state changes that may precede reversals or acceleration


Disclaimer
This indicator is provided for educational purposes only and does not constitute financial advice. Fair Value Gap analysis should be used as part of a comprehensive trading strategy with proper risk management. Past performance of FVG patterns does not guarantee future results.

Indicator Type: Oscillator / Market Analysis Tool

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.