OPEN-SOURCE SCRIPT
Atualizado T4T Value Area Gaps - FVG / IFVG / BPR

T4T VA Gaps - FVG / iFVG / BPR
This indicator filters Fair Value Gaps, Inverted Fair Value Gaps and Balanced Price Ranges by whether it sit on the previous session's value area: the Value Area High (PDVAH), Value Area Low (PDVAL) and Point of Control (PDPOC). Gap tools on their own mark every imbalance on the chart. Volume profile tools on their own show where volume traded, but not where price left inefficiencies. Combining them shows only the imbalance that lines up with prior-session value.
How It Works
1. Previous Session Value Area
- The script builds volume profile for each session (default: 1 day) using lower-timeframe intrabar data (default: 1 minute).
- Each intrabar's volume is spread across the price rows its high-low range covered, in proportion to overlap.
- The POC is the row with highest volume.
- The value area expands outward from the POC, adding the higher-volume neighbouring row each step, until it holds the chosen percentage of the total volume (default 70%).
- When a new session begins, the completed session's VAH, VAL and POC are plotted and carried through the current session.
- If the symbol has no volume data, the profile falls back to time-at-price.
2. Point of Control extension
- Each PDPOC can extend to the right across later sessions until a candle's range trades through it (mitigation).
- Mitigated POC's can be removed or kept, ending at the candle that touched them.
3. Fair Value Gaps
- A bullish FVG forms when the current low is above the high from two bars earlier.
- A bearish FVG forms when the current high is below the low from the two bars earlier.
- Gaps smaller than a set multiple of ATR(14) are ignored.
4. Inverted Fair Value Gaps
- An FVG becomes an iFVG when a candle closes through its far side. The zone then takes the opposite bias.
- An iFVG is invalidated when price closes back through it the other way.
5. Balanced Price Range
- When a new FVG forms within the pairing window of an opposing gap, the overlapping price range between the two is marked as a BPR.
- A BPR is invalidated on a close through its opposite edge.
6. Alignment Filter
- A zone counts as aligned when a selected level (PDVAH, PDVAL and/or PDPOC) is inside the zone, or within a tolerance of its edge (default 0.25 x ATR).
- Aligned zones are labelled with the levels they touch, for example "FVG+ VAH POC".
- When a new session produces new levels, active zones that were not aligned before are checked again.
How To Use
- Add the indicator to an intraday chart below the Session Anchor timeframe. For example, use a 15m-4h chart with a daily anchor.
- "Aligned Only" mode shows only zones that touch prior value.
- "Highlight Aligned" mode shows every zone and emphasises the aligned ones, which is useful for studying context.
- A common way to read it: when price returns to an aligned zone, watch how it reacts at prior-session value. For example, it may reject from a bullish FVG on PDVAL, or fail at bearish iFVG on PDVAH. Treat this as context alongside your own analysis, not a standalone signal.
- The dashboard shows the current PD levels, whether price is above, inside or below prior value, and the number of active aligned zones by type.
- Alerts are available for new aligned bullish or bearish FVG's, iFVG's and BPR's. Alerts are evaluated at bar close.
Settings
- Previous Day Value Area: session anchor, intrabar resolution, profile rows, value area %, level history, colours, POC extension and mitigation behaviour.
- Gap Detection: toggles and colours for each zone type, minimum gap size (x ATR), BPR pairing window, maximum zone age and detection of invalidated zones.
- Value Area Alignment: display mode, tolerance, and which levels count toward alignment.
- Style: fill transparency, zone labels and dashboard position.
Notes & Limitations
- Levels are calculated by this script, so they can differ slightly from TradingView's built-in Session Volume Profile depending on row count and data resolution. Adjust Profile Rows to bring them closer.
- TradingView limits how many intrabars a script can request. Older sessions beyond that limit are built from chart bars, which gives a coarser profile.
- The first session on the chart may be incomplete, so its levels may not be representative.
- Zones and levels are confirmed at bar close. gaps that form on the live bar can appear and disappear until the bar until the bar closes.
- The Session Anchor must be a higher timeframe than the chart.
DISCLAIMER
This indicator is a charting and educational tool. It does not provide buy or sells signals or financial advise, and past behaviour at these levels does not guarantee future results. Always use your own risk management.
This indicator filters Fair Value Gaps, Inverted Fair Value Gaps and Balanced Price Ranges by whether it sit on the previous session's value area: the Value Area High (PDVAH), Value Area Low (PDVAL) and Point of Control (PDPOC). Gap tools on their own mark every imbalance on the chart. Volume profile tools on their own show where volume traded, but not where price left inefficiencies. Combining them shows only the imbalance that lines up with prior-session value.
How It Works
1. Previous Session Value Area
- The script builds volume profile for each session (default: 1 day) using lower-timeframe intrabar data (default: 1 minute).
- Each intrabar's volume is spread across the price rows its high-low range covered, in proportion to overlap.
- The POC is the row with highest volume.
- The value area expands outward from the POC, adding the higher-volume neighbouring row each step, until it holds the chosen percentage of the total volume (default 70%).
- When a new session begins, the completed session's VAH, VAL and POC are plotted and carried through the current session.
- If the symbol has no volume data, the profile falls back to time-at-price.
2. Point of Control extension
- Each PDPOC can extend to the right across later sessions until a candle's range trades through it (mitigation).
- Mitigated POC's can be removed or kept, ending at the candle that touched them.
3. Fair Value Gaps
- A bullish FVG forms when the current low is above the high from two bars earlier.
- A bearish FVG forms when the current high is below the low from the two bars earlier.
- Gaps smaller than a set multiple of ATR(14) are ignored.
4. Inverted Fair Value Gaps
- An FVG becomes an iFVG when a candle closes through its far side. The zone then takes the opposite bias.
- An iFVG is invalidated when price closes back through it the other way.
5. Balanced Price Range
- When a new FVG forms within the pairing window of an opposing gap, the overlapping price range between the two is marked as a BPR.
- A BPR is invalidated on a close through its opposite edge.
6. Alignment Filter
- A zone counts as aligned when a selected level (PDVAH, PDVAL and/or PDPOC) is inside the zone, or within a tolerance of its edge (default 0.25 x ATR).
- Aligned zones are labelled with the levels they touch, for example "FVG+ VAH POC".
- When a new session produces new levels, active zones that were not aligned before are checked again.
How To Use
- Add the indicator to an intraday chart below the Session Anchor timeframe. For example, use a 15m-4h chart with a daily anchor.
- "Aligned Only" mode shows only zones that touch prior value.
- "Highlight Aligned" mode shows every zone and emphasises the aligned ones, which is useful for studying context.
- A common way to read it: when price returns to an aligned zone, watch how it reacts at prior-session value. For example, it may reject from a bullish FVG on PDVAL, or fail at bearish iFVG on PDVAH. Treat this as context alongside your own analysis, not a standalone signal.
- The dashboard shows the current PD levels, whether price is above, inside or below prior value, and the number of active aligned zones by type.
- Alerts are available for new aligned bullish or bearish FVG's, iFVG's and BPR's. Alerts are evaluated at bar close.
Settings
- Previous Day Value Area: session anchor, intrabar resolution, profile rows, value area %, level history, colours, POC extension and mitigation behaviour.
- Gap Detection: toggles and colours for each zone type, minimum gap size (x ATR), BPR pairing window, maximum zone age and detection of invalidated zones.
- Value Area Alignment: display mode, tolerance, and which levels count toward alignment.
- Style: fill transparency, zone labels and dashboard position.
Notes & Limitations
- Levels are calculated by this script, so they can differ slightly from TradingView's built-in Session Volume Profile depending on row count and data resolution. Adjust Profile Rows to bring them closer.
- TradingView limits how many intrabars a script can request. Older sessions beyond that limit are built from chart bars, which gives a coarser profile.
- The first session on the chart may be incomplete, so its levels may not be representative.
- Zones and levels are confirmed at bar close. gaps that form on the live bar can appear and disappear until the bar until the bar closes.
- The Session Anchor must be a higher timeframe than the chart.
DISCLAIMER
This indicator is a charting and educational tool. It does not provide buy or sells signals or financial advise, and past behaviour at these levels does not guarantee future results. Always use your own risk management.
Notas de Lançamento
UPDATENEW
- Previous Week Value Area: PWVAH and PWVAL from the weekly volume profile, plotted and usable for zone alignment (tagged wVAH / wVAL).
- Developing value area: the current session's VAH, VAL and POC drawn as dotted lines that update live, labelled dVAH / dVAL / dPOC. For context only, not used for alignment. Label visibility and size (Tiny / Small / Normal, default Small) are adjustable.
- Session control: optional custom session window and timezone (for example 09:30-16:00 New York). The filter applies to the daily, weekly and developing profiles.
- Higher-timeframe gap source: detect gaps on higher timeframe's confirmed candles and draw them on the current chart without repainting.
- Consequent encroachment: a dashed 50% midline in each zone.
- Zone state tracking: zones show Fresh, then T1, T2... as price returns; tested zones fade. iFVG's start again as Fresh on inversion. Optional "Fresh Zones Only" mode.
- New alert: first test of an aligned bullish or bearish zone.
CHANGES
- Alignment tolerance now used the gap timeframe's ATR, so a zone gets the same alignment result on any chart timeframe.
- Dashboard expanded with PW levels, the developing POC, a fresh-zone count and the active gap and session settings.
- Zone boarders are dotted, width 1.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
#PatiencePays
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.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
#PatiencePays
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.