OPEN-SOURCE SCRIPT
OB/FVG + Volume Profile Confluence

█ OVERVIEW
OB/FVG + Volume Profile Confluence identifies the most relevant supply and demand zones by combining three complementary market analysis concepts: Order Blocks (OB), Fair Value Gaps (FVG), and Volume Profile.
Not every Order Block or Fair Value Gap carries the same weight. Markets create many of them, but only a small fraction actually influences future price action. This script addresses that by cross-checking every newly formed zone against a local volume profile, keeping only the zones that align with areas of increased market participation. Unlike standard Volume Profile tools that rely on a single POC (Point of Control), this script detects multiple local volume peaks (Vol Peaks), allowing several independent high-activity price levels to be tracked at once.
Each zone is continuously analyzed for its internal volume flow, tracking how much of the volume within it was generated by buyers versus sellers. This updates bar by bar, so the user can see which side of the market is gradually gaining control over a given area.
The indicator can also generate break and exit signals, but only for Order Blocks and Fair Value Gaps that are confluent with the Volume Profile, filtering out a large share of less significant levels.
The result is a tool that combines market structure, supply/demand imbalance, and real volume activity — giving traders not just the location of potential reaction zones, but also a read on their quality and historical strength.
█ CONCEPTS
Volume Profile (Vol Peaks)
Volume Profile shows how volume is distributed across price levels rather than looking only at the volume of each individual candle. Most Volume Profile tools focus on a single POC — the price level with the highest traded volume in the analyzed period. In practice, markets often form several local high-activity areas that can also act as meaningful support/resistance levels. Instead of a single POC, this indicator searches for Vol Peaks — local volume maxima across the entire price profile. Each one marks a level where the market showed above-average trading interest, and these levels are later used to score the quality of Order Blocks and Fair Value Gaps.
Order Blocks (OB)
Order Blocks are price zones where significant activity from large market participants previously occurred — areas where strong bullish or bearish impulses began, and where institutions may have built or closed positions. A bullish Order Block marks a demand zone that often preceded a strong upward move; a bearish Order Block marks a supply zone that preceded a strong decline. The script detects Order Blocks from local pivots and the direction of the candles preceding a structure shift, and can use either the full candle range (including wicks) or the body only.
Note: because Order Blocks require a confirmed pivot, each zone is drawn with a delay of roughly pivot_length + 1 bars after the point where it actually formed. This is a structural property of pivot-based detection, not a defect — it should be kept in mind when reading the chart, since the zone is confirmed only after the fact.
Fair Value Gaps (FVG)
A Fair Value Gap marks an imbalance between buyers and sellers. It forms during a strong price impulse, when the market moves fast enough that a gap remains between consecutive candles — evidence that supply and demand were not being matched evenly. These areas frequently attract price during later corrections, as the market tends to retest zones where trading did not occur smoothly. The indicator detects both bullish and bearish FVGs and can optionally display additional, informational gaps regardless of their confluence with the Volume Profile.
Why combine Order Blocks, Fair Value Gaps, and Volume Profile?
Each method looks at the market from a different angle: an Order Block points to where large participants may have acted; a Fair Value Gap shows where a sharp imbalance between buyers and sellers occurred; Volume Profile shows which price levels actually saw the highest concentration of trading activity. Combining the three isolates zones that simultaneously:
• arise from market structure,
• formed during a strong impulse,
• are confirmed by above-average volume activity.
Volume analysis inside zones
No zone is treated as a static rectangle. From the moment it forms, the indicator analyzes every following candle and calculates how much volume was generated by buyers versus sellers. Based on this, it displays the total volume accumulated inside the zone, the volume delta, and the percentage dominance of one side of the market.
Dynamic zone updates
Most indicators draw an Order Block or Fair Value Gap once and leave it unchanged. In this script, every active zone is updated on every new candle — volume calculations, buyer/seller dominance, labels, and zone appearance all change dynamically as the market develops. This means the user sees not just where a zone historically formed, but its current state.
Break and Exit signals
The indicator can generate two types of signals. Break signals mark a definitive break of a zone, meaning it has lost its validity. Exit signals appear when price leaves a zone after having entered it, which can indicate the end of a retest and a return of the dominant market direction. Both signal types are generated only for zones that are confluent with the Volume Profile.
█ FEATURES
Multi-Peak Volume Profile
• Configurable lookback (up to 1000 bars)
• Price range split into bins (up to 100)
• Automatic detection of multiple local Vol Peaks instead of a single POC
• Filters: max number of peaks, minimum peak strength (% of the strongest bin), minimum distance between peaks
• Script-load optimization by recalculating the profile every N bars
• ATR-based confluence tolerance (a zone is considered confluent when a Vol Peak lies within its range or within ATR × multiplier of its edge)
Order Blocks
• Detection based on local pivots (configurable length)
• Option to include wicks or use the candle body only
• Zone-size filter relative to the average candle body size
• Colors, transparency, and optional buyer/seller volume split inside the box
• Dynamic label showing total volume, delta, and percentage dominance
Fair Value Gaps
• Automatic detection of bullish and bearish FVGs
• Gap-size filter relative to the average candle body size
• Optional display of "simple" FVGs without Volume Profile confluence (fixed box length)
• Same volume visualization and labeling options as Order Blocks
OB / FVG confluence with Vol Peaks
• Only zones located at a Vol Peak (or within ATR tolerance) are highlighted as significant
• Non-confluent zones remain nearly invisible or fully hidden
Dynamic in-zone volume analysis
• Continuously updated buyer/seller volume split
• Displays total volume, delta, and percentage dominance
• Border and label color change according to the currently dominant side of the market
Break and Exit signals
• Break — definitive break of a zone (loss of validity)
• Exit — price leaves a zone after having entered it (end of a retest)
• Signals generated only for zones confluent with a Vol Peak
• Separate signals for Order Blocks and Fair Value Gaps
Alerts
• Break Up / Break Down and Exit Up / Exit Down alerts, for both OB and FVG
█ APPLICATIONS
Filtering higher-quality supply and demand zones
The indicator lets you focus only on the Order Blocks and Fair Value Gaps that overlap with local volume peaks, filtering out most of the lower-relevance zones that otherwise clutter the chart.
Reading zone strength in real time
The dynamic volume split shows which side of the market is gradually taking control of a given area. A shift in dominance from buyers to sellers (or vice versa) can indicate a weakening zone.
Retests and breaks as areas of interest
• Exit signals mark potential continuation points after a zone has been retested
• Break signals confirm that a zone has lost validity, which can be relevant when tracking a breakout move
Break and Exit signals mark areas of interest, not automatic entry points. They are not standalone trade triggers — before treating a signal as significant, it is worth checking whether other tools, such as momentum indicators, are aligned with it.
Mapping market structure together with real activity
Vol Peaks combined with OB/FVG form a map of levels where large-participant activity historically concentrated and where a supply/demand imbalance also occurred.
Confirming setups from other methods
Confluent zones can serve as an additional filter for strategies based on market structure, order flow, or classic support/resistance — for example, treating a confluent supply zone as a reason for caution before going long into it, or using a test or break of a confluent zone as one factor among several when evaluating a trade.
Matching lookback to market structure and strategy
The lookback value should be chosen based on the timeframe and trading style. Too large a lookback causes many locally significant zones to be diluted, as the profile "smooths out" short-term peaks. Too small a lookback produces excessive noise and an overly dense grid of levels.
█ NOTES
• A larger lookback and higher bin count produce a more precise profile, but also increase script load. If you run into timeout issues, increase "Recalculate Volume Profile every N bars."
• Order Block zones are drawn with an inherent delay of roughly pivot_length + 1 bars, since they require a confirmed pivot before they can be plotted.
• Only zones with Vol Peak confluence generate Break/Exit signals — all other zones are purely informational.
• Dynamic changes in a zone's color and label reflect current volume flow, not just the historical moment the zone formed.
• Break and Exit signals represent different market behaviors and should be interpreted separately. They are not automatic entry signals — it is recommended to check for alignment with other tools (e.g., momentum indicators) before acting on them.
OB/FVG + Volume Profile Confluence identifies the most relevant supply and demand zones by combining three complementary market analysis concepts: Order Blocks (OB), Fair Value Gaps (FVG), and Volume Profile.
Not every Order Block or Fair Value Gap carries the same weight. Markets create many of them, but only a small fraction actually influences future price action. This script addresses that by cross-checking every newly formed zone against a local volume profile, keeping only the zones that align with areas of increased market participation. Unlike standard Volume Profile tools that rely on a single POC (Point of Control), this script detects multiple local volume peaks (Vol Peaks), allowing several independent high-activity price levels to be tracked at once.
Each zone is continuously analyzed for its internal volume flow, tracking how much of the volume within it was generated by buyers versus sellers. This updates bar by bar, so the user can see which side of the market is gradually gaining control over a given area.
The indicator can also generate break and exit signals, but only for Order Blocks and Fair Value Gaps that are confluent with the Volume Profile, filtering out a large share of less significant levels.
The result is a tool that combines market structure, supply/demand imbalance, and real volume activity — giving traders not just the location of potential reaction zones, but also a read on their quality and historical strength.
█ CONCEPTS
Volume Profile (Vol Peaks)
Volume Profile shows how volume is distributed across price levels rather than looking only at the volume of each individual candle. Most Volume Profile tools focus on a single POC — the price level with the highest traded volume in the analyzed period. In practice, markets often form several local high-activity areas that can also act as meaningful support/resistance levels. Instead of a single POC, this indicator searches for Vol Peaks — local volume maxima across the entire price profile. Each one marks a level where the market showed above-average trading interest, and these levels are later used to score the quality of Order Blocks and Fair Value Gaps.
Order Blocks (OB)
Order Blocks are price zones where significant activity from large market participants previously occurred — areas where strong bullish or bearish impulses began, and where institutions may have built or closed positions. A bullish Order Block marks a demand zone that often preceded a strong upward move; a bearish Order Block marks a supply zone that preceded a strong decline. The script detects Order Blocks from local pivots and the direction of the candles preceding a structure shift, and can use either the full candle range (including wicks) or the body only.
Note: because Order Blocks require a confirmed pivot, each zone is drawn with a delay of roughly pivot_length + 1 bars after the point where it actually formed. This is a structural property of pivot-based detection, not a defect — it should be kept in mind when reading the chart, since the zone is confirmed only after the fact.
Fair Value Gaps (FVG)
A Fair Value Gap marks an imbalance between buyers and sellers. It forms during a strong price impulse, when the market moves fast enough that a gap remains between consecutive candles — evidence that supply and demand were not being matched evenly. These areas frequently attract price during later corrections, as the market tends to retest zones where trading did not occur smoothly. The indicator detects both bullish and bearish FVGs and can optionally display additional, informational gaps regardless of their confluence with the Volume Profile.
Why combine Order Blocks, Fair Value Gaps, and Volume Profile?
Each method looks at the market from a different angle: an Order Block points to where large participants may have acted; a Fair Value Gap shows where a sharp imbalance between buyers and sellers occurred; Volume Profile shows which price levels actually saw the highest concentration of trading activity. Combining the three isolates zones that simultaneously:
• arise from market structure,
• formed during a strong impulse,
• are confirmed by above-average volume activity.
Volume analysis inside zones
No zone is treated as a static rectangle. From the moment it forms, the indicator analyzes every following candle and calculates how much volume was generated by buyers versus sellers. Based on this, it displays the total volume accumulated inside the zone, the volume delta, and the percentage dominance of one side of the market.
Dynamic zone updates
Most indicators draw an Order Block or Fair Value Gap once and leave it unchanged. In this script, every active zone is updated on every new candle — volume calculations, buyer/seller dominance, labels, and zone appearance all change dynamically as the market develops. This means the user sees not just where a zone historically formed, but its current state.
Break and Exit signals
The indicator can generate two types of signals. Break signals mark a definitive break of a zone, meaning it has lost its validity. Exit signals appear when price leaves a zone after having entered it, which can indicate the end of a retest and a return of the dominant market direction. Both signal types are generated only for zones that are confluent with the Volume Profile.
█ FEATURES
Multi-Peak Volume Profile
• Configurable lookback (up to 1000 bars)
• Price range split into bins (up to 100)
• Automatic detection of multiple local Vol Peaks instead of a single POC
• Filters: max number of peaks, minimum peak strength (% of the strongest bin), minimum distance between peaks
• Script-load optimization by recalculating the profile every N bars
• ATR-based confluence tolerance (a zone is considered confluent when a Vol Peak lies within its range or within ATR × multiplier of its edge)
Order Blocks
• Detection based on local pivots (configurable length)
• Option to include wicks or use the candle body only
• Zone-size filter relative to the average candle body size
• Colors, transparency, and optional buyer/seller volume split inside the box
• Dynamic label showing total volume, delta, and percentage dominance
Fair Value Gaps
• Automatic detection of bullish and bearish FVGs
• Gap-size filter relative to the average candle body size
• Optional display of "simple" FVGs without Volume Profile confluence (fixed box length)
• Same volume visualization and labeling options as Order Blocks
OB / FVG confluence with Vol Peaks
• Only zones located at a Vol Peak (or within ATR tolerance) are highlighted as significant
• Non-confluent zones remain nearly invisible or fully hidden
Dynamic in-zone volume analysis
• Continuously updated buyer/seller volume split
• Displays total volume, delta, and percentage dominance
• Border and label color change according to the currently dominant side of the market
Break and Exit signals
• Break — definitive break of a zone (loss of validity)
• Exit — price leaves a zone after having entered it (end of a retest)
• Signals generated only for zones confluent with a Vol Peak
• Separate signals for Order Blocks and Fair Value Gaps
Alerts
• Break Up / Break Down and Exit Up / Exit Down alerts, for both OB and FVG
█ APPLICATIONS
Filtering higher-quality supply and demand zones
The indicator lets you focus only on the Order Blocks and Fair Value Gaps that overlap with local volume peaks, filtering out most of the lower-relevance zones that otherwise clutter the chart.
Reading zone strength in real time
The dynamic volume split shows which side of the market is gradually taking control of a given area. A shift in dominance from buyers to sellers (or vice versa) can indicate a weakening zone.
Retests and breaks as areas of interest
• Exit signals mark potential continuation points after a zone has been retested
• Break signals confirm that a zone has lost validity, which can be relevant when tracking a breakout move
Break and Exit signals mark areas of interest, not automatic entry points. They are not standalone trade triggers — before treating a signal as significant, it is worth checking whether other tools, such as momentum indicators, are aligned with it.
Mapping market structure together with real activity
Vol Peaks combined with OB/FVG form a map of levels where large-participant activity historically concentrated and where a supply/demand imbalance also occurred.
Confirming setups from other methods
Confluent zones can serve as an additional filter for strategies based on market structure, order flow, or classic support/resistance — for example, treating a confluent supply zone as a reason for caution before going long into it, or using a test or break of a confluent zone as one factor among several when evaluating a trade.
Matching lookback to market structure and strategy
The lookback value should be chosen based on the timeframe and trading style. Too large a lookback causes many locally significant zones to be diluted, as the profile "smooths out" short-term peaks. Too small a lookback produces excessive noise and an overly dense grid of levels.
█ NOTES
• A larger lookback and higher bin count produce a more precise profile, but also increase script load. If you run into timeout issues, increase "Recalculate Volume Profile every N bars."
• Order Block zones are drawn with an inherent delay of roughly pivot_length + 1 bars, since they require a confirmed pivot before they can be plotted.
• Only zones with Vol Peak confluence generate Break/Exit signals — all other zones are purely informational.
• Dynamic changes in a zone's color and label reflect current volume flow, not just the historical moment the zone formed.
• Break and Exit signals represent different market behaviors and should be interpreted separately. They are not automatic entry signals — it is recommended to check for alignment with other tools (e.g., momentum indicators) before acting on them.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.
Script de código abierto
Fiel al espíritu de TradingView, el creador de este script lo ha convertido en código abierto, para que los traders puedan revisar y verificar su funcionalidad. ¡Enhorabuena al autor! Aunque puede utilizarlo de forma gratuita, recuerde que cualquier republicación del código está sujeta a nuestras Normas internas.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.