OPEN-SOURCE SCRIPT
Fair Value Gap (FVG) Histogram [Kodeus]

The Fair Value Gap (FVG) Histogram is a tool designed to detect, visualize, and analyze Fair Value Gaps (FVGs) directly on your charts. It combines statistical distribution analysis with real-time signal detection, allowing traders to spot extreme imbalances, evaluate their significance, and track historical performance. This indicator is useful for traders who want to better understand the occurrence and magnitude of gaps in price action while integrating both directional bias and probability analysis.

Pine Script®
Pine Script®
🔷 Key Features
Fair Value Gap Detection: Automatically identifies both bullish and bearish gaps based on price displacements.
Performance Window: Customizable lookback period to evaluate relative gap significance.
Extreme Gap Alerts: Highlight potential trading opportunities when gap magnitude exceeds historical thresholds.
Distribution Analysis: Generates a histogram of gap magnitudes across a user-defined sample size and bucket count.
Frequency Mapping: Optional display of bin frequencies to better understand signal clustering.
Gap Fading Option: Ability to fade minor/insignificant gaps for clearer visual focus.
🔷 Disclaimer
Use with Caution: This indicator is provided for educational and informational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
// Bullish gap condition
low[0] > high[2]
// Bearish gap condition
high[0] < low[2]
🔷 Key Features
Fair Value Gap Detection: Automatically identifies both bullish and bearish gaps based on price displacements.
Performance Window: Customizable lookback period to evaluate relative gap significance.
Extreme Gap Alerts: Highlight potential trading opportunities when gap magnitude exceeds historical thresholds.
Distribution Analysis: Generates a histogram of gap magnitudes across a user-defined sample size and bucket count.
Frequency Mapping: Optional display of bin frequencies to better understand signal clustering.
Gap Fading Option: Ability to fade minor/insignificant gaps for clearer visual focus.
🔷 Disclaimer
Use with Caution: This indicator is provided for educational and informational purposes only and should not be considered as financial advice. Users should exercise caution and perform their own analysis before making trading decisions based on the indicator's signals.
Not Financial Advice: The information provided by this indicator does not constitute financial advice, and the creator shall not be held responsible for any trading losses incurred as a result of using this indicator.
Backtesting Recommended: Traders are encouraged to backtest the indicator thoroughly on historical data before using it in live trading to assess its performance and suitability for their trading strategies.
Risk Management: Trading involves inherent risks, and users should implement proper risk management strategies, including but not limited to stop-loss orders and position sizing, to mitigate potential losses.
No Guarantees: The accuracy and reliability of the indicator's signals cannot be guaranteed, as they are based on historical price data and past performance may not be indicative of future results.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Get access to our exclusive tools: pinescriptmarket.com/
All content provided by Kodeus is for informational & educational purposes only. Past performance does not guarantee future results.
All content provided by Kodeus is for informational & educational purposes only. Past performance does not guarantee future results.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Get access to our exclusive tools: pinescriptmarket.com/
All content provided by Kodeus is for informational & educational purposes only. Past performance does not guarantee future results.
All content provided by Kodeus is for informational & educational purposes only. Past performance does not guarantee future results.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.