PROTECTED SOURCE SCRIPT
Aggiornato [MAD] FVG with LTF-POC/TPO

Overview
The Fair Value Gap (FVG) Detector is a precision tool designed to automatically identify, draw, and track market inefficiencies. These gaps, also known as imbalances, often act as powerful magnets for future price action.
This indicator handles the entire lifecycle of an FVG: from its creation and extension, to the moment it is first touched, and through its entire mitigation process. To add an even deeper layer of analysis, it can now optionally plot two types of micro-analysis lines for the middle candle of the FVG pattern: a volume-based Point of Control (LTF-POC) and a time-based Time Price Opportunity (LTF-TPO). These high-precision lines pinpoint the most significant price levels within the imbalance itself.
By providing a clean and objective visualization of these critical price zones, the FVG Detector gives traders a clear framework for spotting high-probability setups and understanding how the market returns to areas of inefficiency to become balanced once again.
█ How It Works
The indicator’s logic is built on precise detection, dynamic visualization, and intelligent state tracking to provide a comprehensive view of market imbalances.
⚪ The FVG Detection Engine
At its core, the indicator uses a classic three-candle pattern to identify FVGs. This mechanical definition removes all subjectivity:
⚪ Dynamic Drawing and Mitigation
Once an FVG is detected, the indicator automatically draws a colored box to represent the gap. This box is then managed through its entire lifecycle:
⚪ Optional LTF Analysis for Added Precision
The indicator can look "inside" the FVG's middle candle to find its most significant price levels.


█ Why This Indicator is Different
While many traders can spot FVGs manually, this indicator offers a significant edge through the possibility of the lowertimeframe analysis and showing the syntetic TPO or POCs for the relevant candles.
⚪ Automated and Objective
The market moves fast, and manually drawing FVGs is impractical and prone to error. This tool automates the entire process.
⚪ Visualizing Market Memory
This tool does more than just draw boxes; it tells a story. Watching a box change color and shrink provides a visual of market dynamics in action. The optional historical outlines and LTF analysis lines build a "map" on your chart, showing where significant reactions and high-liquidity zones occurred in the past, which provides invaluable context for future price movements.
█ How to Use
⚪ Identifying High-Probability Zones
The primary use of the FVG Detector is to identify high-probability zones where price may react.
⚪ Confluence and Confirmation
FVGs are most powerful when they align with other forms of technical analysis. Look for FVGs that have "confluence" with:
█ Settings
█ The Logic Explained
This indicator uses a clear, rules-based system based on mathematical and conditional principles.
█ Disclaimer
Investors are fully responsible for any investment decisions they make.
Have fun trading :-)
The Fair Value Gap (FVG) Detector is a precision tool designed to automatically identify, draw, and track market inefficiencies. These gaps, also known as imbalances, often act as powerful magnets for future price action.
This indicator handles the entire lifecycle of an FVG: from its creation and extension, to the moment it is first touched, and through its entire mitigation process. To add an even deeper layer of analysis, it can now optionally plot two types of micro-analysis lines for the middle candle of the FVG pattern: a volume-based Point of Control (LTF-POC) and a time-based Time Price Opportunity (LTF-TPO). These high-precision lines pinpoint the most significant price levels within the imbalance itself.
By providing a clean and objective visualization of these critical price zones, the FVG Detector gives traders a clear framework for spotting high-probability setups and understanding how the market returns to areas of inefficiency to become balanced once again.
█ How It Works
The indicator’s logic is built on precise detection, dynamic visualization, and intelligent state tracking to provide a comprehensive view of market imbalances.
⚪ The FVG Detection Engine
At its core, the indicator uses a classic three-candle pattern to identify FVGs. This mechanical definition removes all subjectivity:
- Bullish FVG: A gap is identified when the high of the first candle is lower than the low of the third candle. The space between these two prices creates the bullish FVG.
- Bearish FVG: A gap is identified when the low of the first candle is higher than the high of the third candle. The space between these two prices creates the bearish FVG.
⚪ Dynamic Drawing and Mitigation
Once an FVG is detected, the indicator automatically draws a colored box to represent the gap. This box is then managed through its entire lifecycle:
- Extension: If enabled, the FVG box extends forward in time with each new candle, acting as a visible, forward-looking zone of interest.
- Partial Mitigation Trigger: The moment price first "touches" the gap, the box changes color to signal that it is no longer a fresh, unmitigated zone. The statistics table counts this as a "Partially Mitigated" event.
- Shrinking FVG: As price moves further into the gap, the colored box dynamically shrinks, providing a real-time visual of how much of the imbalance has been filled.
- Historical Outline: An optional secondary outline box is drawn to preserve the FVG's original size. This outline stops extending when the FVG is first touched, leaving a permanent historical marker.
⚪ Optional LTF Analysis for Added Precision
The indicator can look "inside" the FVG's middle candle to find its most significant price levels.
- LTF-POC (Volume-Based): Using data from a lower timeframe, it analyzes the volume profile of the FVG-creating candle to find the single price level from the lower-timeframe bar with the highest trading volume.
- LTF-TPO (Time-Based): It also identifies the Time Price Opportunity by dividing the candle's price range into distinct "bins." The script counts how many lower-timeframe price ticks occurred in each bin, and the TPO line is drawn at the center of the busiest bin.
- Visual Confluence: These are drawn as distinct horizontal lines (defaulting to orange for POC and yellow for TPO) that extend and are managed alongside the FVG's historical outline, serving as precise levels of interest within the broader FVG zone.
█ Why This Indicator is Different
While many traders can spot FVGs manually, this indicator offers a significant edge through the possibility of the lowertimeframe analysis and showing the syntetic TPO or POCs for the relevant candles.
⚪ Automated and Objective
The market moves fast, and manually drawing FVGs is impractical and prone to error. This tool automates the entire process.
- Never Miss a Gap: The detector impartially scans every three-candle sequence, ensuring no FVG is missed.
- No Subjectivity: The rules for detection, mitigation, and LTF analysis are based on fixed mathematical models, removing subjective judgment.
- Multi-Timeframe Clarity: The indicator works flawlessly on any timeframe, allowing you to maintain a consistent view of market structure.
⚪ Visualizing Market Memory
This tool does more than just draw boxes; it tells a story. Watching a box change color and shrink provides a visual of market dynamics in action. The optional historical outlines and LTF analysis lines build a "map" on your chart, showing where significant reactions and high-liquidity zones occurred in the past, which provides invaluable context for future price movements.
█ How to Use
⚪ Identifying High-Probability Zones
The primary use of the FVG Detector is to identify high-probability zones where price may react.
- Entries: Unmitigated (fresh) FVGs can serve as powerful entry zones. Traders may look for price to return to a bullish FVG to take a long position, or to a bearish FVG to take a short position.
- Targets: An FVG in your path can also act as a logical profit target. For example, if you are in a long position, you might take profit as price fills a nearby bearish FVG above you.
⚪ Confluence and Confirmation
FVGs are most powerful when they align with other forms of technical analysis. Look for FVGs that have "confluence" with:
- Market Structure: A bullish FVG found at a key support level or after a bullish break of structure is a higher-probability setup.
- Order Blocks: An FVG that overlaps with a bullish or bearish order block creates a very potent point of interest.
- Premium/Discount Zones: FVGs found deep in a premium (for shorts) or discount (for longs) area of a trading range often yield strong reactions.
- The LTF Lines (POC & TPO): Use these lines as a source of internal confluence. While the FVG gives you a zone, the POC and TPO give you precise levels within that zone. The POC shows where the highest volume was traded, while the TPO shows where price spent the most time. Confluence between these two lines can signal an extremely strong level.
█ Settings
- Max Number of FVGs to Display: Controls how many active FVGs are kept on the chart to prevent clutter and maintain performance.
- Extend Unmitigated FVGs: When enabled, FVG boxes will extend to the right until price touches them.
- Show Bullish/Bearish FVGs: Toggles the visibility of bullish or bearish FVGs.
- Show FVG Labels: Toggles the visibility of the "FVG" text labels.
- Keep Mitigated Outlines: If checked, the historical outline box (and its associated POC/TPO lines) will remain on the chart even after the FVG is completely filled.
- Show Statistics: Toggles the visibility of the statistics table, which tracks total, partly mitigated, and fully mitigated FVGs.
- Show LTF-TPO (Time-Based): Toggles the calculation and display of the Time Price Opportunity line.
- Show LTF-POC (Volume-Based): Toggles the calculation and display of the Point of Control line.
- Use Custom LTF for Analysis: Check this to manually select a timeframe for the POC/TPO calculation. If unchecked, the script auto-selects a lower timeframe.
- Lower Timeframe: The specific lower timeframe to use when the "Custom LTF" box is checked.
- Magnifier (Bars per Slice): Controls how the script auto-selects a lower timeframe (higher number = lower timeframe). Only active when "Custom LTF" is unchecked.
█ The Logic Explained
This indicator uses a clear, rules-based system based on mathematical and conditional principles.
- The 3-Candle FVG Pattern
The detection engine precisely identifies FVGs by comparing the price extremes of a three-candle sequence. For a bullish FVG, it confirms that the high of the first candle is strictly below the low of the third candle. For a bearish FVG, the low of the first candle must be strictly above the high of the third. This leaves an objective, unfilled gap in the market. - The Mitigation and Shrinking Process
Once an FVG is created, the indicator monitors it on every subsequent bar. The moment a candle's price action enters the FVG's zone, it's flagged as "partially mitigated," and its color changes. The script then continues to track how far price pushes into the gap, dynamically shrinking the box to visually represent the remaining imbalance. - Lower-Timeframe (LTF) Analysis Explained
To add precision, the indicator performs a micro-analysis of the middle candle of the FVG pattern. This is achieved by mathematically deconstructing that single candle using data from a smaller timeframe.
The lower timeframe is determined either manually or automatically via the Magnifier. The Magnifier works by dividing the chart's current timeframe. For example, on a 60-minute chart, a Magnifier of 60 tells the indicator to perform its analysis using 1-minute data (60÷60=1).
Once the LTF data is obtained, two calculations are performed:
LTF Point of Control (Volume-Based): This method seeks the price of maximum commitment. The indicator analyzes the volume of every single lower-timeframe bar within the main candle and identifies the one bar with the highest trading volume. The closing price of that specific high-volume bar is designated as the POC.
LTF Time Price Opportunity (Time-Based): This method finds the price where the market spent the most time trading. The process is a form of price distribution analysis:
The total price range (high to low) of the main candle is measured.
This range is divided into 40 equal price zones, or "bins". For a candle with a $2 range, each bin would represent a price slice of 5 cents
The indicator then counts how many of the lower-timeframe closing prices fall within each of the 40 bins.
The TPO line is drawn at the midpoint of the single bin that contained the most prices, representing the "busiest" price level. - Time-Based Drawing for Accuracy
To ensure perfect alignment across all historical data and chart reloads, all drawings are anchored to the precise timestamp of the bar, not its sequential position on the chart. This robust method guarantees that all zones remain fixed and accurate regardless of how much historical data is loaded.
█ Disclaimer
Investors are fully responsible for any investment decisions they make.
Have fun trading :-)
Note di rilascio
█ What's New in the Pro Suite?The FVG Pro Suite is a major evolution from the original [MAD] FVG with LTF-POC/TPO script. It introduces powerful new analytical tools designed to transform FVG data into actionable trading intelligence.
- [] Advanced Statistics Table: The original script provided a basic count of FVGs. The Pro Suite introduces a comprehensive analytics table that breaks down FVG performance by:
[] Trend Context: See separate statistics for FVGs that formed with the trend versus counter-trend.
[] Performance Metrics: Track average fill percentage, rebound strength (in 'R' multiples), and the average time it takes for a gap to be mitigated.
[] Dynamic Zones Table: This is a completely new feature that acts as a trading dashboard. It automatically finds the four nearest unmitigated FVGs above and below the current price and calculates:
[] Stat-Based Entry (S-Entry): A projected entry price based on the historical average fill rate for that type of FVG.
[] Stat-Based Target (S-Tgt): A projected profit target based on the historical average rebound value.
[] Risk-to-Reward: Instantly see the potential gain (in 'R') for each upcoming zone.
[] Trend-Based Analysis: An EMA has been integrated to classify each FVG as either "With Trend" or "Counter Trend," allowing for a more nuanced statistical analysis. - Enhanced Customization: The on-chart labels are now more informative, showing the FVG's size in percent and dynamically updating their position and content as the zone is mitigated.
Note di rilascio
Poc bin bug fixedNote di rilascio
Zones Table Logic OverhaulThe logic for finding zones for the bottom-right table has been completely rewritten to be more intelligent and responsive.
Old Behavior: The table would only show FVGs that were completely above or below the current price candle. This meant that as soon as price wicked into a zone to test it, the zone would disappear from the table, which was incorrect.
New Behavior: The table now correctly identifies and displays zones as long as they are generally above or below the current price close.
This ensures that partially mitigated zones and zones currently being tested by price remain visible in the table, providing a much more accurate and useful view of active support and resistance levels.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script protetto
Questo script è pubblicato come codice protetto. Tuttavia, è possibile utilizzarlo liberamente e senza alcuna limitazione – per saperne di più clicca qui.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.