Order Blocks FVG and Price Gaps with Volume Profile

ORDER BLOCKS FVG AND PRICE GAPS WITH VOLUME PROFILE
This is an open-source overlay indicator that brings order blocks, fair value gaps, adjacent-candle price gaps, and a right-side volume profile into one configurable chart. The purpose is not to label every possible market structure or predict the next move. It is to make several different kinds of price displacement visible, keep their current status consistent, and let you decide how much of that information you want on the chart.
The three zone types answer different questions. An order block identifies an opposite-direction origin candle followed by a qualifying displacement. A fair value gap identifies an untraded price window within a three-candle sequence. A price gap identifies a discontinuity between two consecutive candles. The volume profile provides a separate view of where reported volume was distributed across price during a fixed lookback. The dashboard connects these views without turning their overlap into an automatic trading signal.

A central design choice is that a zone's rectangle, boundary, and confirming-candle color are independent. You can use filled zones without colored candles, boundaries without fills, candle colors without visible rectangles, or any combination that suits your chart. Each type has its own controls. The default configuration keeps candle coloring off, uses transparent fills, and leaves boundaries and labels disabled so that the initial chart remains readable.




The indicator also distinguishes between a historical signal and a currently active zone. That distinction matters particularly when choosing a candle color mode. Historical confirming-candle colors and removable live-status colors are not the same feature, and the following section explains which mode to use for each purpose.
START WITH THE PRICE SCALE
Protect chart scale is OFF by default. Older, still-active order blocks and unfilled fair value gaps can therefore remain drawn below or above the recent market range, subject to the age filter and storage limits. A zone is not hidden merely because it is far from current price.
If the candles look compressed or the chart appears to shrink, right-click the price scale and enable Scale price chart only. This tells TradingView to base automatic scaling on the price chart rather than distant indicator drawings. It preserves the visible zones without using the script's distance-based hiding filter.
Scale price chart only is a TradingView chart setting, not a Pine input. The script cannot enable it for you.
Protect chart scale remains available as an optional display filter. If enabled, it hides zone rectangles, boundaries, and labels outside the recent 100-bar candle range plus a margin, which defaults to 10 percent. On a 4-hour chart, 100 candles cover about 17 days: older support zones can be hidden even when they lie inside the wider chart area you are viewing. Hidden zones remain active internally. This option does not change detection, confluence, alerts, or candle coloring. Leave it off when you want to see distant active zones.
The Order blocks ignore the scale guard and Price gaps ignore scale guard switches only matter when Protect chart scale is enabled. The price-gap exemption remains enabled by default; the order-block exemption remains disabled. With Protect chart scale off, neither order blocks nor fair value gaps are hidden by the guard.
Input values are hidden from the chart status line by default. Every input uses display.data_window, excluding it from status-line display while retaining eligible values in the Data Window. All inputs remain editable in Settings then Inputs. This controls input-value display, not the script title, dashboard footer, or TradingView's global status-line preference. Pine cannot force the UI checkbox itself off for an existing chart instance.
CANDLE COLOR MODES: ACTUAL CANDLES BY DEFAULT

The default candle color mode is Actual candles. This mode colors the native confirming candle itself, including its body and wick. It is the cleanest choice when you want the chart to look like ordinary colored candles rather than an overlay drawn on top of them.
Actual candles is also the mode to use for historical confirming-candle colors. Once a native candle has been colored, that color remains after the associated zone later fills, breaks, is touched, ages out, or is evicted from storage. The color therefore records where a qualifying confirmation occurred. It is not proof that the zone is still active. Use the remaining rectangles, dashboard, and zone status to understand the current working set.
Removable drawings is still available, but it is not the default. It is an optional current-zone overlay mode. When selected, it draws a candle-body and wick overlay centered on the confirming candle only while the zone is active, untouched, and age-visible. The overlay is deleted on first touch, fill, break, age-out, or eviction. First touch removes the removable candle color even when the rectangle itself remains visible under a Full fill rule.

Removable drawings uses drawing objects, not native candle color. Pine cannot erase a native historical candle color after the fact, so a removable historical color must be represented by a drawing. The script shapes those drawings as a candle body and wick and does not use marker symbols, arrows, circles, or letters as a substitute. The overlay is still an approximation of native candle geometry, and it shares Pine's finite box budget with zone rectangles and profile rows. The script limits those marks and gives priority to newer qualifying zones.

The scale guard does not hide removable candle overlays. Removable color follows the zone's active, untouched, and age-visible status, not the rectangle's scale-guard visibility.
For historical candle coloring, leave the mode on Actual candles and enable the relevant Color candles switches. For a current-zone-only visual, switch to Removable drawings and accept that it is an overlay with a drawing budget. Neither mode makes completed zone rectangles permanent. Filled or broken zones are still removed according to their rules. Available chart history, the selected age window, the enabled zone types, and the detection settings still determine which confirmations can be colored when the script calculates.
In short: Actual candles is the default native-candle mode and the historical-color mode. Removable drawings is the optional active-zone overlay mode.
THE DEFAULT COLOR KEY
The default colors are deliberately different across the three zone types:
Bullish order blocks use green; bearish order blocks use dark red.
Bullish fair value gaps use light green; bearish fair value gaps use red.
Bullish price gaps use yellow; bearish price gaps use blue.
The default profile uses white for up-volume segments and black for down-volume segments.
One-sided and zero-total-volume profile rows use red.
Profile levels and row outlines start white and have a separate adjustable color.
The dashboard uses a solid black background with type-specific row colors.
These are starting colors, not fixed requirements. Fill and candle colors, bullish and bearish boundary colors, and profile colors can be changed in the settings. The separate fair value gap shades make it easier to distinguish a three-candle imbalance from an order block when both appear on the same chart.
A bullish or bearish classification describes the direction of the detected displacement or gap. It is not a guarantee that price will continue in that direction, and it does not identify actual institutional orders.
HOW ORDER BLOCKS ARE DETECTED

The order block logic tries to identify the last opposite-direction candle, or a short cluster of opposite-direction candles, immediately before a qualifying impulsive move. It does not wait for a confirmed swing pivot and it does not require a later N-bar structure break.
A bullish order block requires:
A bearish origin candle, or a short consecutive bearish origin cluster.
A following upward run of one or more bullish candles, ending on the confirming candle.
The confirming candle to close above the top of the origin range.
The confirming candle's body to meet the configured ATR threshold.
The optional volume condition to pass, if enabled.
A bearish order block uses the opposite conditions: a bullish origin candle or cluster, a following downward run ending on a bearish confirming candle that closes below the bottom of the origin range, and the same body-size and optional volume requirements.
The default body threshold is 0.65 times the previous bar's 14-period ATR reference. This is a permissive displacement filter rather than a rare-event filter. Increasing Displacement body ATR multiple demands a larger confirming candle body and generally produces fewer order blocks. Reducing it admits smaller displacements.
Two controls define how strictly the origin and impulse are matched:
Maximum impulse run bars limits the total number of consecutive same-direction candles in the run ending on the confirming candle, including that confirming candle. A value of 1 restores the strict one-candle displacement test.
Maximum origin cluster bars limits how many consecutive opposite-direction candles may be merged into the origin zone. A value of 1 uses only the last single opposite-direction candle.
Only the confirming candle must satisfy the ATR body threshold. Earlier candles in the run only need to share its direction.
Order block confirmation decides what the confirming candle has to do to the origin range before a block is created:
Close beyond origin is the original test and the default. A bullish block needs a closing price above the top of the origin range, and a bearish block needs a closing price below the bottom of the origin range.
Wick beyond origin accepts a wick that passes the origin extreme while the candle closes back inside it. This adds the blocks where price displaced sharply and retraced within the same candle.
Displacement body only removes the breakout test entirely and accepts every qualifying displacement candle that follows an opposite-direction origin. This is the most permissive option and the closest match to tools that mark every displacement rather than only clean breaks.
The breakout test is the strictest part of the order block rule. On a weekly chart it removes roughly half of the patterns that would otherwise qualify, so this input is the first place to look when a chart feels sparse.
The zone itself comes from the origin candle or cluster. Under OB range set to Wicks, its boundaries are the highest high and lowest low of the origin cluster. Under Bodies, its boundaries are the highest body top and lowest body bottom of the origin cluster. The body setting creates a narrower zone; the wick setting includes the full origin range.
The rectangle begins at the oldest candle in the origin cluster, but the candle eligible for coloring is the current impulse candle that confirms the pattern. The origin candle is not retroactively painted. This distinction keeps the candle color tied to the moment when the indicator could first confirm the order block under close-confirmed settings.
The optional Require volume above 1.10x its 20 SMA filter requires the confirming candle's volume to exceed 1.10 times its 20-period simple moving average of volume. It is off by default. This can be useful on instruments with consistent volume reporting, but it should not be treated as a universal quality filter for symbols with missing or incomparable volume data.
An order block remains active while price tests its range, provided the invalidation condition has not occurred. Order block invalidation selects that condition:
Close beyond opposite edge is the original rule and the default. A bullish order block is broken when a candle closes below its lower boundary, and a bearish order block is broken when a candle closes above its upper boundary.
Wick beyond opposite edge waits for a wick to trade completely through the block before it is removed.
Keep until aged out never removes a block because of price. The rectangle, its boundaries, its label, and its candle color stay in place until the zone age filter hides the block or the storage limit evicts it.
A wick beyond the far boundary is not, by itself, the close-based break used in the default setting. The invalidation choice matters most for how long a block stays on the chart: with the default rule, a weekly chart removes more than half of the blocks it detects. Whatever the setting, a block that price has already traded through is historical context, not a fresh setup.
This is a price-and-volume heuristic. The name order block does not mean that the script can see an institution's order book or verify that a particular participant entered at that location.
HOW FAIR VALUE GAPS ARE DETECTED

A fair value gap uses three candles and compares the current candle with the candle two bars earlier. The middle candle is part of the displacement sequence, but the empty price window is defined by the two outer candles.
A bullish fair value gap exists when the current low is above the high from two bars earlier. The zone runs from that earlier high to the current low.
A bearish fair value gap exists when the current high is below the low from two bars earlier. The zone runs from the current high to that earlier low.
The separation must be positive and at least one minimum tick. The default Minimum gap ATR multiple is 0.10, using the previous bar's ATR reference. Raising this value filters out smaller imbalances, which can be particularly useful on fast timeframes where many tiny gaps may otherwise qualify.
The script also applies a directional impulse filter to the middle candle. By default, Middle candle impulse ATR multiple is 0.65. When this value is above zero, the middle candle must point in the gap direction and its body must be at least that multiple of the previous ATR reference. This is intended to reduce geometric gaps that are not produced by a clear directional displacement. Setting the impulse multiple to zero leaves only the three-candle gap geometry and the minimum gap-size filter.
The rectangle begins at the older outer candle. The candle eligible for coloring is the third candle, because that is the candle whose completed range confirms the gap. The script does not color all three pattern candles.
The default removal rule is Full fill. A bullish gap is filled when price trades down to its lower boundary; a bearish gap is filled when price trades up to its upper boundary. The alternative, First touch, removes the gap when price first enters its range.
Full fill keeps partially traded gaps visible. First touch treats the first retest as the end of the displayed opportunity. Neither rule proves that the gap will hold or that price must revisit it; they simply define when this indicator stops treating it as an active zone.
HOW ADJACENT-CANDLE PRICE GAPS DIFFER

The price gap module compares two consecutive candles. This is intentionally different from the three-candle fair value gap test.
Under the default Wick gap definition, a bullish price gap requires the current low to be above the previous high. A bearish price gap requires the current high to be below the previous low. The complete high-low ranges must be separated, leaving a genuinely empty interval between adjacent candles.
Under Body gap, only the real bodies need to be separated. The wicks may overlap. This produces more zones and can be useful on continuous intraday markets where complete wick-to-wick gaps are uncommon.
The default minimum gap size is 0.05 times the previous ATR reference, subject to the one-tick minimum. As with fair value gaps, increasing the ATR multiple makes the filter more selective.
The rectangle begins at the previous candle. The current, second candle confirms the gap and is the only candle eligible for that gap's color.
Price gaps support the same Full fill and First touch removal choices as fair value gaps. Under Full fill, price must trade through the gap to its opposite boundary. Under First touch, entering the gap ends its active display.
WHY AN UNFILLED GAP CAN GO MISSING ON A LOWER TIMEFRAME
Three separate mechanisms can remove a price gap from the chart while the gap is still unfilled. All three are now either changed for price gaps or made visible in the dashboard.
The optional scale guard, now OFF by default. When enabled, it compares each zone against the recent 100-bar candle range. On a 3-day chart, 100 bars can span the entire listed history, so almost every gap passes. On a 4-hour chart, 100 bars covers only a few weeks, so an older gap far below the current price fails the test and its rectangle is hidden even though the zone is still active. Price gaps ignore scale guard is enabled by default to remove this timeframe dependency for price gaps.
The storage limit. Price gaps now have their own Maximum stored price gaps input, default 200, instead of sharing the 40-zone limit used by order blocks and fair value gaps. Two years of 4-hour history contains far more gaps than two years of 3-day history, so a shared low limit evicted the oldest unfilled gaps first on exactly the timeframes where you most wanted to see them.
The FVG deduplication rule. With Keep fair value gap selected, a price gap that overlaps a same-direction fair value gap is intentionally not drawn. Whether that overlap exists depends on the chart timeframe, because the three-candle pattern itself is timeframe-specific.
The dashboard now reports each of these separately, so a missing gap is never unexplained. Hover either GAP BULL or GAP BEAR row label to see how many gaps are stored, the effective storage limit, how many are hidden by the age view, how many were dropped by the storage limit, how many were suppressed by the deduplication rule, and whether the scale-guard exemption is active. The bottom status line also shows gaps stored/limit and a dropped count when it is above zero.
One honest limitation remains: gaps are detected from the candles of the chart you are viewing. The script does not copy a gap found on one timeframe onto another. The changes above remove the display and storage reasons a genuine gap on your current timeframe could disappear; they do not merge gap definitions across timeframes.
Keeping the two gap definitions separate is useful because a two-candle discontinuity and a three-candle imbalance are not interchangeable measurements. At the same time, one displacement can satisfy both tests. The next section explains how the script avoids presenting that single event as two independent same-direction signals.
ONE EVENT SHOULD NOT BECOME TWO ALIGNED GAP ZONES
A displacement candle can create both a fair value gap and an adjacent-candle price gap over overlapping price ranges. Drawing both rectangles and counting both as confluence can make one event look like two separate pieces of evidence.
Show only one of an aligned FVG and price gap is enabled by default to address this.
When an active fair value gap and price gap have the same direction and a positive price-range overlap, the script keeps the preferred type. The default is Keep fair value gap. The alternative is Keep price gap.
The surviving zone retains its own original boundaries. The script does not merge the two ranges into a larger rectangle or silently replace one definition with a hybrid. If the fair value gap is preferred, its three-candle boundaries remain intact. If the price gap is preferred, its two-candle boundaries remain intact.
Opposite-direction overlaps are not removed by this setting. A bullish zone overlapping a bearish zone can represent conflicting context, so that relationship remains available to the dashboard, labels, and confluence alerts.
Order blocks are also unaffected by this deduplication. An order block can still overlap either kind of gap and participate in confluence normally.
The overlap test requires an actual shared price interval. Merely touching at one boundary is not treated as a positive overlap. This keeps the duplicate suppression and confluence logic tied to a meaningful intersection rather than adjacent contact.
If you want to study both raw gap definitions independently, the deduplication option can be disabled. The default is intended for a cleaner event count, not to suggest that one definition is universally more predictive.
ZONE LIFECYCLE, RETESTS, AND REMOVAL
All three zone types are stored as active ranges until their removal rule is met or they are evicted by the per-type storage limit.
A first retest occurs when a later candle's high-low range intersects a stored zone. The confirming candle itself is not counted as its own first retest. Subsequent intersecting candles increase the touch counter. That counter is best understood as a count of touching bars, not a sophisticated count of separate intrabar visits.
The dashboard's TESTED column is a subset of its LIVE column. It counts active, age-visible zones that have already recorded at least one retest. It is not a count of all historical zones that were ever tested, because completed zones are removed.
Order blocks use close-based invalidation beyond the far boundary. Fair value gaps and price gaps use the selected full-fill or first-touch rule. With Wait for candle close enabled, these lifecycle decisions are applied at the close.
Once a zone is invalidated, its rectangle, boundary, label, and removable candle marks are removed rather than kept as a historical mitigation archive. In Removable drawings mode, the candle color is also removed on the first touch, even if the rectangle remains visible under a Full fill rule. This is intentional: the zone display represents the current working set. If you want a lasting record of the confirming candles, use the default Actual candles mode.
The age filter does not itself invalidate a zone. A zone outside the selected age window can remain active internally and reappear if the selected window changes. By contrast, a filled or broken zone is removed and is not restored simply by widening the age view.
Disabling a zone type stops new detections of that type. Already stored zones continue to be managed until they are removed under their normal rules. If you want a clean restart after changing the detection configuration, remove and re-add the indicator rather than assuming that every existing zone disappears immediately.
CANDLE COLORING: ONLY THE CONFIRMING CANDLE
Each zone type has its own Color candles switch, and all three are off by default.
When enabled:
An order block colors its displacement candle, not the earlier origin candle.
A fair value gap colors the third candle, not the entire three-candle pattern.
A price gap colors the second candle, not the preceding reference candle.
The color includes the body and wick. There are no arrows, circles, letters, or other marker shapes placed above or below the candle as a substitute for coloring it. The color represents the detected zone direction, not necessarily the native candle's own up/down color. For example, a fair value gap direction is determined by the three-candle range relationship and the impulse filter, not by requiring the third candle itself to have a particular native color.
When more than one zone type confirms on the same candle, only one zone color is applied. The default Overlap priority is order block, then fair value gap, then price gap. Two alternative priority orders are available. Colors are not blended into an ambiguous intermediate shade.
Candle color source can use either the zone's fill color or its boundary color. Fill color is the default, so a colored confirming candle normally matches its rectangle. Boundary colors are independent, and they can be used for candle coloring even when the boundary lines themselves are disabled.
The two candle modes serve different purposes:
Actual candles is the default. It colors the native candle body and wick. The color remains after the associated zone later fills, breaks, is touched, ages out, or is evicted, so it should be read as a historical confirmation color rather than proof that the zone is still active.
Removable drawings is optional. It creates a body overlay and a thin wick overlay only for zones that are active, untouched, and age-visible. These are drawn after the zone boxes, allowing them to appear in front of zone fills and boundaries. They are removed on first touch, fill, break, age-out, or eviction. First touch removes the removable color even if the rectangle survives under Full fill. The scale guard does not suppress these overlays.
Removable body width and wick width are adjustable. Their positions and widths are reconstructed from candle prices and bar duration, so they are approximations of native candle geometry rather than the native candle objects themselves. On charts with unusual spacing or session breaks, you may prefer Actual candles or want to adjust the overlay width.
Pine has fixed drawing-layer groups. Removable candle boxes can be placed above zone boxes and boundary lines, but labels belong to a higher layer. Also, native chart candles are not individually reorderable against every script drawing. The removable overlay approach is used specifically to keep the colored body and wick readable over the zone rectangles without pretending that Pine offers unrestricted per-object layer control.
INDEPENDENT FILLS, BOUNDARIES, AND LABELS


The display controls are separated so that one visual decision does not force another.
For each zone type, you can independently control:
Whether its confirming candle is colored.
Whether its rectangle has a fill.
Whether its boundary is drawn.
Its bullish and bearish fill colors.
Its bullish and bearish boundary colors.
Its boundary style.
Its fill transparency.
The default fill transparency is 80 for all three types. In TradingView's transparency convention, a higher number means a more transparent fill. The defaults are meant to leave price action readable through the zones.
Boundary lines are off by default. Each type can use solid, dashed, or dotted boundaries. Boundary width and boundary transparency are shared controls, while the boundary colors and styles remain type-specific.
Optional zone labels are also off by default. When enabled, a label can show the zone type, direction, same-direction or opposite-direction overlap state, and whether its range contains the current point of control or intersects the value area.
Hovering a zone label provides additional context: its upper and lower boundaries, whether it is fresh or tested, its displacement body or gap height in ATR terms, the origin range high and low, the confirming candle high and low, the confirming candle's volume relative to its 20-period average, and its recorded touch count. These details are intended to make it easier to audit why a zone was accepted.
The label is contextual information, not a buy or sell instruction. A zone intersecting the value area is not automatically more likely to hold, and opposite-direction confluence is not automatically a reversal signal.
Active zones project 12 bars into the future by default. Active zone projection bars changes only the drawing's right edge. It does not change detection, removal, confluence, or alert logic.
THE AGE FILTER IS A VIEW, NOT A TIME MACHINE
Enable zone age filter is on by default, with Last 1 year selected.
The available views are intentionally limited to practical recent windows:
Last 1 month
Last 6 months
Current year
Last 1 year
Last 2 years
Last 1 month and Last 6 months are rolling windows approximated as 30.4375 and 182.625 days. Last 1 year and Last 2 years are rolling windows of 365.25 and 730.5 days. Current year uses the calendar year in the symbol's exchange timezone. Age is measured from the close time of the confirming candle to the chart's last bar, so rolling windows move forward as the chart advances.
The filter affects which stored zones are visible and included in age-dependent counts and zone alerts. Detection still runs across the loaded history, and the lifecycle of stored zones continues even when a zone is outside the selected view.
This separation has several practical consequences:
Widening the age view can reveal an older zone that is still stored and active.
It cannot restore a zone already removed because it filled, broke, or exceeded the storage limit.
It does not guarantee a removable candle overlay for every eligible historical confirmation.
It does not increase the amount of price history supplied by TradingView.
It does not make the fixed-lookback volume profile cover the entire selected age window.
In the default Actual candles mode, the selected age window determines which historical confirming candles are eligible to be colored, but those native colors are not erased when a zone later fills or is touched. In optional Removable drawings mode, candle colors are deleted when a zone ages out of the selected window.
For scalping, Last 1 month may be enough. For swing trading, Last 6 months is often a practical middle ground. For position trading, Current year, Last 1 year, or Last 2 years may be more appropriate. The age filter is not a backtest engine and does not reconstruct a sequence of historical dashboard states. It is a way to control which parts of the stored zone set are relevant to the current chart view.
WHY AN ORDER BLOCK CAN BE MISSING ON A HIGH TIMEFRAME
Order block detection runs on every bar of the loaded history. What you see depends on the age filter, invalidation rules, storage limits, and, only if enabled, the optional scale guard. The scale guard is OFF by default.
A measured example on a weekly Bitcoin series with 409 weekly candles between 2019 and 2026: the default rules detected 26 order blocks, 10 were still active at the last bar, and only 3 of those were born inside the default Last 1 year window. The other 7 blocks were detected, stored, and still valid, but the age filter hid them. Enabling Order blocks ignore the zone age filter draws all 10 without changing a single detection rule.
In earlier defaults, the enabled scale guard could hide distant blocks even after they passed the age filter. That guard is now OFF by default. With the current defaults, a stored, active block passing the age filter is not hidden because of its distance from recent price. If you explicitly re-enable Protect chart scale, Order blocks ignore the scale guard exempts OB rectangles from that optional distance filter; fair value gaps remain subject to it.
One year is about 52 weekly candles. Any block older than that disappears from a weekly chart while it is still open, which is why the summary panel can report a surprisingly small number of live blocks on a high timeframe. Lowering the ATR threshold does not fix that, because the blocks that are missing were never rejected by detection in the first place.
STORAGE AND DRAWING LIMITS ARE DELIBERATE
Pine allows a finite number of drawing objects. This indicator uses boxes for zone rectangles, profile rows, and removable candle bodies and wicks, so it manages them as a shared resource rather than allowing older objects to be garbage-collected unpredictably.
Exempting order blocks from the age filter or the scale guard changes visibility, not storage. The type limit still applies, so a chart with years of history keeps the newest 40 order blocks and evicts older ones. If a block you expect is neither drawn nor listed in the dashboard, check the storage limit before changing any detection input.
The default storage limit is 40 zones each for order blocks and fair value gaps. Price gaps have a separate and much larger limit, Maximum stored price gaps, default 200, because a lower timeframe generates far more gaps over the same calendar window. When a type exceeds its limit, the script removes older stored zones of that type, preferring ones already hidden by the age filter, and it never evicts the zone that was just confirmed.
The price gap limit is also bounded by the shared Pine drawing budget. The script reserves room for the configured profile rows and for the order block and fair value gap limits, then caps the effective gap limit so the total stays below Pine's 500-box maximum. The dashboard reports the effective limit rather than the requested one, so the two are never confused.
Removable candle marks are budgeted separately during each refresh. The script accounts for existing zone boxes, reserves space for the configured profile rows, and retains a safety margin below Pine's 500-box limit. It then draws qualifying marks from newer zones first.
Each removable candle requires both a body box and a wick box. Increasing the number of profile rows reserves more of the shared budget and can reduce the number of removable candles available. Increasing the number of stored zones can have a similar effect.
This is why the selected age window is not a promise of complete historical removable coloring. The script prefers a controlled recent display over silently exceeding the drawing limit and losing arbitrary objects.
The default Actual candles mode avoids using those body and wick boxes for candle coloring. It does not remove the need to manage active zone storage, but it is better suited to retaining historical confirming-candle colors across the loaded chart.
On very busy symbols or fast timeframes, reducing stored zones, profile rows, or the profile lookback can also reduce calculation and drawing work. These are practical load controls, not changes to the underlying definition of a qualifying candle pattern.
WHAT THE RIGHT-SIDE VOLUME PROFILE MEASURES



The volume profile estimates how reported volume was distributed across price during a fixed number of chart bars. The default lookback is 250 bars and the default number of price rows is 24.
Unlike a time-volume histogram below the chart, this profile organizes volume vertically by price and displays it horizontally. Longer rows represent more volume assigned to that price interval. The highest-volume row defines the point of control, or POC.
By default, Use lower timeframe volume is enabled. Where suitable intrabar data is available, each chart candle's volume is examined through lower-timeframe candles rather than simply distributing the entire chart-candle volume across its full high-low range.
The process has several steps:
Collect confirmed chart-bar slices within the configured lookback.
Request lower-timeframe data where a valid intrabar resolution is available.
Divide each source candle's range into fine internal price bins.
Distribute that candle's reported volume across the bins according to price-range overlap.
Aggregate those fine bins into the final profile rows.
Calculate the POC and value-area boundaries from the resulting row totals.
Draw the profile in the right-hand margin and update the dashboard.
The internal allocation is uniform across the portion of a source candle's range that overlaps a bin. It is not reconstructed from individual trades at their exact execution prices. Using lower-timeframe bars improves the price-location estimate, but it does not turn OHLCV data into a tick-by-tick order-flow record.
The profile's price range comes from the stored source slices. Final rows are equal-price intervals over that range; they are not automatically rounded to an exchange-specific row-size convention. Changing the number of rows changes the aggregation and can move the reported POC or value-area edges.
The POC line is drawn at the center of the highest-volume row. If multiple rows tie for the maximum, the lower-priced row encountered first is used. These details matter when comparing the output with another profile implementation.

This is an original Pine reconstruction designed to provide useful lower-timeframe context. It is not TradingView's built-in volume profile engine, not a tick-exact replica, and not a bid/ask delta profile.
UP VOLUME, DOWN VOLUME, AND THE VALUE AREA
In the default split profile, each populated row contains a down-volume segment and an up-volume segment. Down volume is placed on the left side of the row and up volume on the right.
A source candle contributes to up volume when its close is at or above its open. It contributes to down volume when its close is below its open. The candle's direction determines that classification; the script is not observing whether trades occurred at the bid or ask.
Calling these categories up volume and down volume is therefore more accurate than calling them genuine buying pressure and selling pressure. Every trade has both a buyer and a seller, and candle direction is only a classification rule.
The default level color is white. It is used for profile row outlines, the POC, the value-area high, the value-area low, and related dashboard text. POC value area and row outline color lets you change that color without changing the zone palette. The POC uses a thicker line than the dashed value-area edges so that it remains distinguishable.
The default value-area target is 70 percent of profile volume. Starting from the POC row, the calculation compares the adjacent rows above and below and selects the one with more volume. Equal-volume choices favor the row closer to the POC, with the upper side preferred if distance is also equal.
The expansion stops at the edge of the profile or before adding a row that would push the accumulated volume beyond the target. Because the profile uses discrete rows, the percentage is a target rather than a promise that the displayed area contains exactly that percentage. Boundary rows are not subdivided merely to hit the target precisely.
The value-area high is the upper edge of the highest included row. The value-area low is the lower edge of the lowest included row. These are profile-derived reference levels, not guaranteed support or resistance.
The optional Extend POC and VA lines across lookback setting extends the three levels leftward across the stored profile window. Otherwise, they remain confined to the profile area. The separate label switch can show POC, VAH, VAL, and the profile's bar count and data status.
ONE-SIDED AND ZERO-VOLUME ROWS
Two additional profile conditions can be highlighted in red.
A one-sided row is a populated row whose reported volume is dominated by one candle-direction category. The default threshold is 100 percent, meaning that the row contains only up-classified volume or only down-classified volume. Lowering the threshold also flags strongly dominant but mixed rows.
A zero-volume row is a price interval inside the profile's overall range that received no allocated volume in the selected lookback. It is shown as a small marker at the right edge rather than as a full-length volume bar.
These conditions have different meanings. A one-sided row has volume but lacks representation from the opposite candle-direction category at the selected resolution. A zero-volume row has no allocated volume in the reconstruction. Neither condition proves that no liquidity existed there or that price must react in a particular way on a revisit.
Both highlights are enabled by default and share one warning color. They take visual priority over the normal split or value-area coloring. The one-sided threshold, highlight switches, zero-volume marker width, and shared warning color are configurable.
The dashboard counts the underlying one-sided and zero-volume conditions even when their visual highlighting is turned off. This lets you hide the extra color without losing the summary count.
One-sided classifications depend on the available source resolution and row aggregation. A row that appears pure at one resolution may contain mixed source candles at a finer resolution. Treat the highlight as a description of the current reconstruction, not as a direct measurement of market participation.
INTRABAR RESOLUTION, FALLBACK, AND PROFILE STATUS
The default intrabar timeframe override is empty, which means Auto. The script chooses a common lower-timeframe resolution intended to fit the configured lookback within the intrabar data budget.
The default budget is 100,000 lower-timeframe bars. You can adjust it to match the data limit available under your TradingView plan. A larger budget can allow finer resolution across a longer lookback, but it also increases the amount of data the script processes.
A manual override is available when you want a specific intrabar timeframe. It must actually be lower than the chart timeframe and supported by the symbol's data and your plan. An invalid or non-lower selection falls back to the chart-bar estimate rather than producing a valid finer-resolution profile.
On charts of one minute or less, Auto may have no finer common resolution available and can use the chart-bar estimate. A supported manual seconds timeframe may provide intrabar detail on suitable second-based or minute charts, but availability is not universal.
The dashboard and optional profile title report the data mode:
LTF followed by a timeframe means the stored profile bars used lower-timeframe data.
LTF+est means the profile combines lower-timeframe slices with chart-bar estimates.
chart est means the displayed profile uses the chart-bar allocation method.
no volume means the selected data produced no usable positive volume.
no bars means there are no stored profile slices available for the calculation.
These status labels are important. A profile should not be compared with a native lower-timeframe profile without checking whether it actually received lower-timeframe data.
For a meaningful comparison with TradingView's built-in tools, align the covered price-history range, row count, value-area percentage, and volume classification as closely as possible. A fixed lookback of 250 chart bars is not automatically the same range as a manually selected Fixed Range profile or the current Visible Range profile.
Even with matched settings, differences can remain because of source resolution, intrabar availability, row boundaries, allocation method, POC tie handling, and value-area expansion. The objective is a closer and more informative estimate than simple chart-candle spreading, not a claim of exact equality.
READING THE DASHBOARD

The dashboard is enabled by default at the bottom left, with small text and a solid black background. Its position and text size are adjustable.
There is one row for each combination of zone type and direction: bullish and bearish order blocks, fair value gaps, and price gaps. The row names use the corresponding zone colors so that the table remains visually connected to the chart.
The columns report:
LIVE: active zones that pass the selected age view.
TESTED: the subset of those live zones that has recorded a retest.
NEAREST: the price of the nearest zone edge for that type and direction. If the close is already inside a qualifying zone, the close is shown. The cell is blank when no qualifying zone exists.
PROFILE: how many zones of that type and direction intersect the current value area. A nonzero count is shown with a VA prefix.
The dashboard also shows the current POC and value-area boundaries, same-direction and opposite-direction cross-type overlap pairs, the number of zones containing the current close, the number of stored profile bars, and the profile's data status.
The bottom line summarizes the close-confirmed profile status, one-sided row count, zero-volume row count, selected age view, and the price gap storage state as gaps stored/limit, with a dropped count when gaps have been evicted.
The two price gap rows carry a diagnostic tooltip. Hover the GAP BULL or GAP BEAR row label to see the stored gap count, the effective storage limit, how many gaps are hidden by the age view, how many were dropped by the storage limit, how many were suppressed by the fair value gap deduplication rule, and whether the scale-guard exemption is active. This is the fastest way to identify why a specific unfilled gap is not on the chart.
Several distinctions are useful when interpreting these numbers:
LIVE is not a count of every historical signal.
TESTED is not a separate population added to LIVE; it is a subset.
NEAREST is a price, not a distance in ticks or a probability score.
A value-area overlap count is not a confluence-pair count.
AT PRICE counts qualifying zones containing the close, so overlapping zones can contribute more than one count.
SAME DIR and OPPOSITE count pairs of active, age-visible zones from different types, not the total number of zones involved.
Scale-guard visibility does not remove a zone from these internal counts.
The dashboard is a compact state summary. It does not rank setups, estimate win rates, or issue trade instructions.
CONFLUENCE MEANS OVERLAP, NOT CONFIRMATION OF A TRADE
The script distinguishes same-direction confluence from opposite-direction confluence.
Same-direction confluence means that active zones from different types overlap in price and point in the same direction. Opposite-direction confluence means that active zones from different types overlap but have opposing directions.
The overlap must have positive height. Sharing only a boundary is not enough. Zones of the same type are not paired with each other for these dashboard counts.
The default same-direction fair-value-gap and price-gap deduplication reduces duplicate counting when one displacement satisfies both definitions. It does not prevent an order block from overlapping a gap, and it does not suppress opposite-direction relationships.
Confluence alerts are event alerts associated with a newly confirmed, age-visible zone. They are not continuously repeated on every candle merely because two old zones still overlap. The dashboard, by contrast, reports the current overlap-pair state.
A same-direction overlap can help organize context, but it can also result from several measurements of the same move. An opposite-direction overlap can identify an area where different displacement signals meet, but it does not tell you which side will prevail.
The profile adds another reference layer. A zone containing the POC or intersecting the value area may deserve attention within your own process, but that intersection is not independent proof of future support, resistance, or direction.
CLOSE CONFIRMATION AND REPAINTING BEHAVIOR
Wait for candle close is enabled by default.
With this setting, new zones and zone lifecycle decisions are processed on confirmed candles. A pattern that appears temporarily during a live candle is not accepted as a new confirmed zone until that candle closes.
The alert conditions are also gated to confirmed candles. This remains true even if you disable the visual wait setting. Optional combined alert messages use the once-per-bar-close alert frequency.
Turning off Wait for candle close enables intrabar previews. Those previews can appear, change, or disappear before the candle closes. They should not be treated as stable historical signals, and the live preview may not match what is ultimately confirmed.
The volume profile stores confirmed source slices independently of this visual preview choice. Its latest levels can still change as new confirmed bars enter the fixed lookback and older bars leave it. A POC or value-area touch alert therefore refers to the currently calculated profile level, not an immutable level that was known at some earlier date.
Close confirmation removes one important source of signal repainting. It does not make market outcomes predictable, eliminate data-feed revisions, or turn the volume profile into an exact historical record of tick volume.
For normal use and historical review, leave Wait for candle close enabled.
ALERTS
The script includes 23 individual alert conditions, grouped around zone creation, retests, removal, confluence, and profile-level touches.
New-zone conditions are available for:
Bullish and bearish order blocks.
Bullish and bearish fair value gaps.
Bullish and bearish price gaps.
Any newly confirmed zone.
First-retest conditions are available for any zone, each individual zone type, and bullish or bearish zones. Removal conditions are available for any invalidated zone and for each type separately. There is also a condition for a close entering a stored zone from outside it.
Additional conditions cover same-direction confluence, opposite-direction confluence, a touch of the POC, a touch of the value-area high, and a touch of the value-area low.
To create an individual alert, select the indicator in TradingView's alert dialog and choose the relevant condition. Once per bar close is the appropriate frequency for the intended confirmed-event workflow.
The optional Send combined alert() messages setting is off by default. When enabled, it sends a dynamic message containing the events detected on a closed candle, along with the symbol, timeframe, and closing price. To receive those messages, create an alert using Any alert() function call.
Do not enable overlapping individual alerts and the combined message path unless you intentionally want more than one notification for the same event.
Several event details matter:
First retest means the first qualifying intersection recorded for a stored zone, not the first touch of a price level across all history.
A close-enter event requires the previous close to have been outside the zone and the current close to be inside it.
A single closed candle can produce multiple different event types, but an individual condition does not enumerate every affected zone in its static message.
New-zone, first-retest, invalidation, and close-enter events require the affected zone to pass the selected age view. Confluence is evaluated when an age-visible new zone overlaps another active zone of a different type.
Hiding a rectangle through the scale guard does not by itself disable its underlying zone events.
Profile levels are recalculated as the profile window advances, so their touch conditions are tied to the current profile state.
Alerts are notifications of defined chart conditions. They are not order-execution instructions or recommendations to enter a position.
PRACTICAL WAYS TO CONFIGURE THE CHART
For a relatively clean current-market workspace, start with the defaults: transparent zone fills, no boundaries or labels, candle coloring off, candle mode set to Actual candles, the profile enabled, and the dashboard at the bottom left. Enable Scale price chart only on the chart itself.
If you want native candle confirmation colors, enable Color candles only for the types you actually use and leave the mode on Actual candles. Expect those colors to remain historically after the zone later fills, breaks, or is touched. Read them as confirmation events, not as proof that the zone is still active.
If you want a current-zone-only candle visual, switch to Removable drawings and enable the relevant Color candles switches. Expect those colors to follow active, untouched, age-visible status and the available drawing budget rather than act as a historical archive. First touch removes the removable color even when the rectangle remains visible under Full fill.
Choose the age window to match your trading horizon. Last 1 month can suit scalping, Last 6 months can suit swing trading, and Current year, Last 1 year, or Last 2 years can suit position trading. The default is Last 1 year.
If you prefer an outline-only chart, disable the rectangle fills and enable boundaries for the desired types. Candle coloring can remain enabled independently. If you want candles to use the boundary palette, change Candle color source to Boundary color.
If fair value gaps and price gaps feel redundant, leave same-direction deduplication enabled and choose the definition you prefer. If you are comparing the two methodologies, disable deduplication temporarily and remember that overlapping same-direction results may describe the same displacement.
If an unfilled price gap is missing on one timeframe but present on another, check the price gap diagnostic tooltip first. A nonzero dropped count means the storage limit is too low for that timeframe. A nonzero age-hidden count means the age view is too narrow. A nonzero dedupe count means a same-direction fair value gap is intentionally taking precedence. If all three are zero and the gap is still absent, confirm that Price gaps ignore scale guard is enabled and that Enable price gaps is on for that chart.
If older support zones are missing, first confirm that Protect chart scale is OFF. This applies to both order blocks and fair value gaps. If the candles then look compressed, right-click the price scale and enable Scale price chart only; do not hide the desired zones to repair scaling. Next check the selected age window, storage limits, and whether the zone has actually filled or broken. One year is about 52 weekly candles. The optional Order blocks ignore the zone age filter switch can reveal older stored blocks without changing detection. Other indicators may also use different detection rules or higher-timeframe zones; identical results are not guaranteed. Do not loosen confirmation or retain invalidated blocks merely to increase the number of rectangles.
If the chart is too busy, reduce the number of zone types, lower the storage limits, raise the ATR thresholds, or disable optional labels and boundaries before changing the underlying definitions. If removable historical marks are the issue, switch candle modes rather than repeatedly widening the age filter.
If the profile is the main focus, align its lookback and row count with the comparison range, check the data-status field, and use the profile labels only when you need exact level prices on the chart. Extend the POC and value-area lines when studying reactions across the lookback; keep them confined to the right margin when you want a cleaner price area.
For fast second-based charts, start with a modest lookback and avoid enabling every optional visual at once. The indicator is designed to support second-based timeframes where the required data is available, but execution time still depends on the symbol, history, intrabar resolution, and TradingView plan. If a one-second chart reaches an execution limit, a 15-second chart is a practical fallback. Reducing profile lookback, row count, stored zones, or disabling the profile can also reduce load.
DEFAULT CONFIGURATION AT A GLANCE
The main defaults are:
All three zone detections enabled.
Order block range based on wicks, with a 0.65 ATR displacement-body threshold, a maximum impulse run of 3 bars, and a maximum origin cluster of 3 bars.
Order block confirmation set to Close beyond origin, and order block invalidation set to Close beyond opposite edge.
Order blocks follow the zone age filter by default. The separate age exemption is off. Protect chart scale is OFF, so its distance filter does not hide OBs or FVGs.
Order block volume filter disabled.
Fair value gap minimum size of 0.10 ATR and a middle-candle impulse threshold of 0.65 ATR.
Price gaps based on wick separation, with a minimum size of 0.05 ATR.
Price gaps exempt from the scale guard, with a separate storage limit of 200 gaps.
Full-fill removal for both gap types.
Same-direction FVG and price-gap deduplication enabled, preferring the fair value gap.
Fourteen-period ATR used for the displacement and gap-size reference.
Twelve-bar active-zone projection.
Up to 40 stored order blocks and 40 stored fair value gaps.
Age filter enabled with Last 1 year selected; available views are Last 1 month, Last 6 months, Current year, Last 1 year, and Last 2 years.
All three candle-color switches disabled.
Candle mode set to Actual candles. Removable drawings remains optional, with body width at 70 percent and wick width at 2 percent of a bar when selected.
Candle color source set to Fill color.
Overlap priority set to order block, then fair value gap, then price gap.
Zone fills enabled at 80 transparency.
Zone boundaries and labels disabled; boundary width is 1 pixel and boundary transparency is 0.
Protect chart scale OFF. Its optional margin remains 10 percent of the recent 100-bar range when enabled.
Input values hidden from the chart status line through display.data_window on every input; all controls remain editable in Settings then Inputs.
If drawings compress the candles, right-click the price scale and enable Scale price chart only.
Volume profile enabled with lower-timeframe data preferred.
Automatic intrabar resolution and a 100,000-intrabar budget.
Profile lookback of 250 chart bars, 24 rows, and a 70 percent value-area target.
Profile width of 55 bars and an offset of 10 bars.
One-sided and zero-volume highlighting enabled.
Profile level and bar-count labels disabled.
Dashboard enabled at the bottom left with small text.
Wait for candle close enabled.
Combined alert messages disabled.
Every input includes a tooltip explaining its purpose. The settings are intended to be explored without needing to infer what a control changes from its name alone.
SCOPE, ORIGINALITY, AND LIMITATIONS
Order blocks, fair value gaps, price gaps, and volume profiles are established chart-analysis concepts. The originality of this implementation is in how they are combined and managed: independent visual channels, explicit confirming-candle selection, removable versus native candle coloring, same-event FVG/gap deduplication, cross-type confluence, an age-aware working set, a right-margin-only profile, and a shared drawing-budget strategy.
The implementation does not reuse another author's script or library. Its detection rules and reconstruction method are described above so that users can evaluate what the drawings actually represent rather than relying on a vague smart-money label.
The main limitations are equally important:
Order blocks are inferred from price and optional volume conditions, not observed institutional orders. The origin cluster and impulse-run controls are heuristic approximations of the last opposite-direction candle or cluster before a strong move.
Fair value gaps and price gaps are geometric range relationships, not guarantees of a future fill or reaction. The FVG impulse filter reduces some weak geometric gaps, but it does not turn the pattern into a validated trading signal.
The profile is an intrabar or chart-bar allocation estimate, not tick-exact volume at price.
Up/down volume is candle-direction volume, not bid/ask order flow.
Native visible-range selection and this script's fixed chart-bar lookback are not automatically identical.
Removable candle history is intentionally limited by active-zone status and drawing resources.
Actual candle colors can remain after a zone is no longer active and must be interpreted accordingly.
Completed zones are removed rather than maintained as a full historical mitigation database, unless order block invalidation is set to Keep until aged out. Blocks kept that way are context, not confirmed live zones, and the dashboard counts them as active until they age out or are evicted.
Letting order blocks ignore the age filter and the scale guard increases how much of the stored history is painted. It does not increase how much history TradingView supplies, and it can pull the price scale toward distant levels.
Price gap detection uses the candles of the current chart timeframe. The storage and display fixes make an unfilled gap on that timeframe persist consistently, but the script does not transplant a gap detected on one timeframe onto another.
Intrabar availability, second-based data access, loaded history, and execution limits depend on the instrument and TradingView plan.
No setting or combination of overlaps constitutes a validated trading edge by itself.
Use the indicator as a structured way to inspect displacement, unfinished price ranges, and volume distribution. Combine it with your own market context, risk controls, and testing rather than treating a color or dashboard count as a stand-alone decision system.
This publication is for chart analysis and educational use. It does not provide financial advice, guarantee results, or recommend any particular trade.
DISCLAIMER & RISK DISCLOSURE
This indicator is provided for informational and educational purposes only. It does not constitute financial or investment advice or a recommendation to buy or sell any financial instrument.
Trading involves risk, and losses can exceed your initial investment, particularly when using leveraged products. Always make your own trading decisions and manage your risk accordingly.
Indicator signals, zones, profiles, and alerts are based on technical calculations and market data. They are not guarantees of market direction, accuracy, or profitability. Past performance does not guarantee future results.
The indicator is provided free of charge, as is, without guarantees of accuracy, reliability, or uninterrupted availability. The author is not responsible for trading losses or damages resulting from its use, to the extent permitted by applicable law.
This is an open-source overlay indicator that brings order blocks, fair value gaps, adjacent-candle price gaps, and a right-side volume profile into one configurable chart. The purpose is not to label every possible market structure or predict the next move. It is to make several different kinds of price displacement visible, keep their current status consistent, and let you decide how much of that information you want on the chart.
The three zone types answer different questions. An order block identifies an opposite-direction origin candle followed by a qualifying displacement. A fair value gap identifies an untraded price window within a three-candle sequence. A price gap identifies a discontinuity between two consecutive candles. The volume profile provides a separate view of where reported volume was distributed across price during a fixed lookback. The dashboard connects these views without turning their overlap into an automatic trading signal.
A central design choice is that a zone's rectangle, boundary, and confirming-candle color are independent. You can use filled zones without colored candles, boundaries without fills, candle colors without visible rectangles, or any combination that suits your chart. Each type has its own controls. The default configuration keeps candle coloring off, uses transparent fills, and leaves boundaries and labels disabled so that the initial chart remains readable.
The indicator also distinguishes between a historical signal and a currently active zone. That distinction matters particularly when choosing a candle color mode. Historical confirming-candle colors and removable live-status colors are not the same feature, and the following section explains which mode to use for each purpose.
START WITH THE PRICE SCALE
Protect chart scale is OFF by default. Older, still-active order blocks and unfilled fair value gaps can therefore remain drawn below or above the recent market range, subject to the age filter and storage limits. A zone is not hidden merely because it is far from current price.
If the candles look compressed or the chart appears to shrink, right-click the price scale and enable Scale price chart only. This tells TradingView to base automatic scaling on the price chart rather than distant indicator drawings. It preserves the visible zones without using the script's distance-based hiding filter.
Scale price chart only is a TradingView chart setting, not a Pine input. The script cannot enable it for you.
Protect chart scale remains available as an optional display filter. If enabled, it hides zone rectangles, boundaries, and labels outside the recent 100-bar candle range plus a margin, which defaults to 10 percent. On a 4-hour chart, 100 candles cover about 17 days: older support zones can be hidden even when they lie inside the wider chart area you are viewing. Hidden zones remain active internally. This option does not change detection, confluence, alerts, or candle coloring. Leave it off when you want to see distant active zones.
The Order blocks ignore the scale guard and Price gaps ignore scale guard switches only matter when Protect chart scale is enabled. The price-gap exemption remains enabled by default; the order-block exemption remains disabled. With Protect chart scale off, neither order blocks nor fair value gaps are hidden by the guard.
Input values are hidden from the chart status line by default. Every input uses display.data_window, excluding it from status-line display while retaining eligible values in the Data Window. All inputs remain editable in Settings then Inputs. This controls input-value display, not the script title, dashboard footer, or TradingView's global status-line preference. Pine cannot force the UI checkbox itself off for an existing chart instance.
CANDLE COLOR MODES: ACTUAL CANDLES BY DEFAULT
The default candle color mode is Actual candles. This mode colors the native confirming candle itself, including its body and wick. It is the cleanest choice when you want the chart to look like ordinary colored candles rather than an overlay drawn on top of them.
Actual candles is also the mode to use for historical confirming-candle colors. Once a native candle has been colored, that color remains after the associated zone later fills, breaks, is touched, ages out, or is evicted from storage. The color therefore records where a qualifying confirmation occurred. It is not proof that the zone is still active. Use the remaining rectangles, dashboard, and zone status to understand the current working set.
Removable drawings is still available, but it is not the default. It is an optional current-zone overlay mode. When selected, it draws a candle-body and wick overlay centered on the confirming candle only while the zone is active, untouched, and age-visible. The overlay is deleted on first touch, fill, break, age-out, or eviction. First touch removes the removable candle color even when the rectangle itself remains visible under a Full fill rule.
Removable drawings uses drawing objects, not native candle color. Pine cannot erase a native historical candle color after the fact, so a removable historical color must be represented by a drawing. The script shapes those drawings as a candle body and wick and does not use marker symbols, arrows, circles, or letters as a substitute. The overlay is still an approximation of native candle geometry, and it shares Pine's finite box budget with zone rectangles and profile rows. The script limits those marks and gives priority to newer qualifying zones.
The scale guard does not hide removable candle overlays. Removable color follows the zone's active, untouched, and age-visible status, not the rectangle's scale-guard visibility.
For historical candle coloring, leave the mode on Actual candles and enable the relevant Color candles switches. For a current-zone-only visual, switch to Removable drawings and accept that it is an overlay with a drawing budget. Neither mode makes completed zone rectangles permanent. Filled or broken zones are still removed according to their rules. Available chart history, the selected age window, the enabled zone types, and the detection settings still determine which confirmations can be colored when the script calculates.
In short: Actual candles is the default native-candle mode and the historical-color mode. Removable drawings is the optional active-zone overlay mode.
THE DEFAULT COLOR KEY
The default colors are deliberately different across the three zone types:
Bullish order blocks use green; bearish order blocks use dark red.
Bullish fair value gaps use light green; bearish fair value gaps use red.
Bullish price gaps use yellow; bearish price gaps use blue.
The default profile uses white for up-volume segments and black for down-volume segments.
One-sided and zero-total-volume profile rows use red.
Profile levels and row outlines start white and have a separate adjustable color.
The dashboard uses a solid black background with type-specific row colors.
These are starting colors, not fixed requirements. Fill and candle colors, bullish and bearish boundary colors, and profile colors can be changed in the settings. The separate fair value gap shades make it easier to distinguish a three-candle imbalance from an order block when both appear on the same chart.
A bullish or bearish classification describes the direction of the detected displacement or gap. It is not a guarantee that price will continue in that direction, and it does not identify actual institutional orders.
HOW ORDER BLOCKS ARE DETECTED
The order block logic tries to identify the last opposite-direction candle, or a short cluster of opposite-direction candles, immediately before a qualifying impulsive move. It does not wait for a confirmed swing pivot and it does not require a later N-bar structure break.
A bullish order block requires:
A bearish origin candle, or a short consecutive bearish origin cluster.
A following upward run of one or more bullish candles, ending on the confirming candle.
The confirming candle to close above the top of the origin range.
The confirming candle's body to meet the configured ATR threshold.
The optional volume condition to pass, if enabled.
A bearish order block uses the opposite conditions: a bullish origin candle or cluster, a following downward run ending on a bearish confirming candle that closes below the bottom of the origin range, and the same body-size and optional volume requirements.
The default body threshold is 0.65 times the previous bar's 14-period ATR reference. This is a permissive displacement filter rather than a rare-event filter. Increasing Displacement body ATR multiple demands a larger confirming candle body and generally produces fewer order blocks. Reducing it admits smaller displacements.
Two controls define how strictly the origin and impulse are matched:
Maximum impulse run bars limits the total number of consecutive same-direction candles in the run ending on the confirming candle, including that confirming candle. A value of 1 restores the strict one-candle displacement test.
Maximum origin cluster bars limits how many consecutive opposite-direction candles may be merged into the origin zone. A value of 1 uses only the last single opposite-direction candle.
Only the confirming candle must satisfy the ATR body threshold. Earlier candles in the run only need to share its direction.
Order block confirmation decides what the confirming candle has to do to the origin range before a block is created:
Close beyond origin is the original test and the default. A bullish block needs a closing price above the top of the origin range, and a bearish block needs a closing price below the bottom of the origin range.
Wick beyond origin accepts a wick that passes the origin extreme while the candle closes back inside it. This adds the blocks where price displaced sharply and retraced within the same candle.
Displacement body only removes the breakout test entirely and accepts every qualifying displacement candle that follows an opposite-direction origin. This is the most permissive option and the closest match to tools that mark every displacement rather than only clean breaks.
The breakout test is the strictest part of the order block rule. On a weekly chart it removes roughly half of the patterns that would otherwise qualify, so this input is the first place to look when a chart feels sparse.
The zone itself comes from the origin candle or cluster. Under OB range set to Wicks, its boundaries are the highest high and lowest low of the origin cluster. Under Bodies, its boundaries are the highest body top and lowest body bottom of the origin cluster. The body setting creates a narrower zone; the wick setting includes the full origin range.
The rectangle begins at the oldest candle in the origin cluster, but the candle eligible for coloring is the current impulse candle that confirms the pattern. The origin candle is not retroactively painted. This distinction keeps the candle color tied to the moment when the indicator could first confirm the order block under close-confirmed settings.
The optional Require volume above 1.10x its 20 SMA filter requires the confirming candle's volume to exceed 1.10 times its 20-period simple moving average of volume. It is off by default. This can be useful on instruments with consistent volume reporting, but it should not be treated as a universal quality filter for symbols with missing or incomparable volume data.
An order block remains active while price tests its range, provided the invalidation condition has not occurred. Order block invalidation selects that condition:
Close beyond opposite edge is the original rule and the default. A bullish order block is broken when a candle closes below its lower boundary, and a bearish order block is broken when a candle closes above its upper boundary.
Wick beyond opposite edge waits for a wick to trade completely through the block before it is removed.
Keep until aged out never removes a block because of price. The rectangle, its boundaries, its label, and its candle color stay in place until the zone age filter hides the block or the storage limit evicts it.
A wick beyond the far boundary is not, by itself, the close-based break used in the default setting. The invalidation choice matters most for how long a block stays on the chart: with the default rule, a weekly chart removes more than half of the blocks it detects. Whatever the setting, a block that price has already traded through is historical context, not a fresh setup.
This is a price-and-volume heuristic. The name order block does not mean that the script can see an institution's order book or verify that a particular participant entered at that location.
HOW FAIR VALUE GAPS ARE DETECTED
A fair value gap uses three candles and compares the current candle with the candle two bars earlier. The middle candle is part of the displacement sequence, but the empty price window is defined by the two outer candles.
A bullish fair value gap exists when the current low is above the high from two bars earlier. The zone runs from that earlier high to the current low.
A bearish fair value gap exists when the current high is below the low from two bars earlier. The zone runs from the current high to that earlier low.
The separation must be positive and at least one minimum tick. The default Minimum gap ATR multiple is 0.10, using the previous bar's ATR reference. Raising this value filters out smaller imbalances, which can be particularly useful on fast timeframes where many tiny gaps may otherwise qualify.
The script also applies a directional impulse filter to the middle candle. By default, Middle candle impulse ATR multiple is 0.65. When this value is above zero, the middle candle must point in the gap direction and its body must be at least that multiple of the previous ATR reference. This is intended to reduce geometric gaps that are not produced by a clear directional displacement. Setting the impulse multiple to zero leaves only the three-candle gap geometry and the minimum gap-size filter.
The rectangle begins at the older outer candle. The candle eligible for coloring is the third candle, because that is the candle whose completed range confirms the gap. The script does not color all three pattern candles.
The default removal rule is Full fill. A bullish gap is filled when price trades down to its lower boundary; a bearish gap is filled when price trades up to its upper boundary. The alternative, First touch, removes the gap when price first enters its range.
Full fill keeps partially traded gaps visible. First touch treats the first retest as the end of the displayed opportunity. Neither rule proves that the gap will hold or that price must revisit it; they simply define when this indicator stops treating it as an active zone.
HOW ADJACENT-CANDLE PRICE GAPS DIFFER
The price gap module compares two consecutive candles. This is intentionally different from the three-candle fair value gap test.
Under the default Wick gap definition, a bullish price gap requires the current low to be above the previous high. A bearish price gap requires the current high to be below the previous low. The complete high-low ranges must be separated, leaving a genuinely empty interval between adjacent candles.
Under Body gap, only the real bodies need to be separated. The wicks may overlap. This produces more zones and can be useful on continuous intraday markets where complete wick-to-wick gaps are uncommon.
The default minimum gap size is 0.05 times the previous ATR reference, subject to the one-tick minimum. As with fair value gaps, increasing the ATR multiple makes the filter more selective.
The rectangle begins at the previous candle. The current, second candle confirms the gap and is the only candle eligible for that gap's color.
Price gaps support the same Full fill and First touch removal choices as fair value gaps. Under Full fill, price must trade through the gap to its opposite boundary. Under First touch, entering the gap ends its active display.
WHY AN UNFILLED GAP CAN GO MISSING ON A LOWER TIMEFRAME
Three separate mechanisms can remove a price gap from the chart while the gap is still unfilled. All three are now either changed for price gaps or made visible in the dashboard.
The optional scale guard, now OFF by default. When enabled, it compares each zone against the recent 100-bar candle range. On a 3-day chart, 100 bars can span the entire listed history, so almost every gap passes. On a 4-hour chart, 100 bars covers only a few weeks, so an older gap far below the current price fails the test and its rectangle is hidden even though the zone is still active. Price gaps ignore scale guard is enabled by default to remove this timeframe dependency for price gaps.
The storage limit. Price gaps now have their own Maximum stored price gaps input, default 200, instead of sharing the 40-zone limit used by order blocks and fair value gaps. Two years of 4-hour history contains far more gaps than two years of 3-day history, so a shared low limit evicted the oldest unfilled gaps first on exactly the timeframes where you most wanted to see them.
The FVG deduplication rule. With Keep fair value gap selected, a price gap that overlaps a same-direction fair value gap is intentionally not drawn. Whether that overlap exists depends on the chart timeframe, because the three-candle pattern itself is timeframe-specific.
The dashboard now reports each of these separately, so a missing gap is never unexplained. Hover either GAP BULL or GAP BEAR row label to see how many gaps are stored, the effective storage limit, how many are hidden by the age view, how many were dropped by the storage limit, how many were suppressed by the deduplication rule, and whether the scale-guard exemption is active. The bottom status line also shows gaps stored/limit and a dropped count when it is above zero.
One honest limitation remains: gaps are detected from the candles of the chart you are viewing. The script does not copy a gap found on one timeframe onto another. The changes above remove the display and storage reasons a genuine gap on your current timeframe could disappear; they do not merge gap definitions across timeframes.
Keeping the two gap definitions separate is useful because a two-candle discontinuity and a three-candle imbalance are not interchangeable measurements. At the same time, one displacement can satisfy both tests. The next section explains how the script avoids presenting that single event as two independent same-direction signals.
ONE EVENT SHOULD NOT BECOME TWO ALIGNED GAP ZONES
A displacement candle can create both a fair value gap and an adjacent-candle price gap over overlapping price ranges. Drawing both rectangles and counting both as confluence can make one event look like two separate pieces of evidence.
Show only one of an aligned FVG and price gap is enabled by default to address this.
When an active fair value gap and price gap have the same direction and a positive price-range overlap, the script keeps the preferred type. The default is Keep fair value gap. The alternative is Keep price gap.
The surviving zone retains its own original boundaries. The script does not merge the two ranges into a larger rectangle or silently replace one definition with a hybrid. If the fair value gap is preferred, its three-candle boundaries remain intact. If the price gap is preferred, its two-candle boundaries remain intact.
Opposite-direction overlaps are not removed by this setting. A bullish zone overlapping a bearish zone can represent conflicting context, so that relationship remains available to the dashboard, labels, and confluence alerts.
Order blocks are also unaffected by this deduplication. An order block can still overlap either kind of gap and participate in confluence normally.
The overlap test requires an actual shared price interval. Merely touching at one boundary is not treated as a positive overlap. This keeps the duplicate suppression and confluence logic tied to a meaningful intersection rather than adjacent contact.
If you want to study both raw gap definitions independently, the deduplication option can be disabled. The default is intended for a cleaner event count, not to suggest that one definition is universally more predictive.
ZONE LIFECYCLE, RETESTS, AND REMOVAL
All three zone types are stored as active ranges until their removal rule is met or they are evicted by the per-type storage limit.
A first retest occurs when a later candle's high-low range intersects a stored zone. The confirming candle itself is not counted as its own first retest. Subsequent intersecting candles increase the touch counter. That counter is best understood as a count of touching bars, not a sophisticated count of separate intrabar visits.
The dashboard's TESTED column is a subset of its LIVE column. It counts active, age-visible zones that have already recorded at least one retest. It is not a count of all historical zones that were ever tested, because completed zones are removed.
Order blocks use close-based invalidation beyond the far boundary. Fair value gaps and price gaps use the selected full-fill or first-touch rule. With Wait for candle close enabled, these lifecycle decisions are applied at the close.
Once a zone is invalidated, its rectangle, boundary, label, and removable candle marks are removed rather than kept as a historical mitigation archive. In Removable drawings mode, the candle color is also removed on the first touch, even if the rectangle remains visible under a Full fill rule. This is intentional: the zone display represents the current working set. If you want a lasting record of the confirming candles, use the default Actual candles mode.
The age filter does not itself invalidate a zone. A zone outside the selected age window can remain active internally and reappear if the selected window changes. By contrast, a filled or broken zone is removed and is not restored simply by widening the age view.
Disabling a zone type stops new detections of that type. Already stored zones continue to be managed until they are removed under their normal rules. If you want a clean restart after changing the detection configuration, remove and re-add the indicator rather than assuming that every existing zone disappears immediately.
CANDLE COLORING: ONLY THE CONFIRMING CANDLE
Each zone type has its own Color candles switch, and all three are off by default.
When enabled:
An order block colors its displacement candle, not the earlier origin candle.
A fair value gap colors the third candle, not the entire three-candle pattern.
A price gap colors the second candle, not the preceding reference candle.
The color includes the body and wick. There are no arrows, circles, letters, or other marker shapes placed above or below the candle as a substitute for coloring it. The color represents the detected zone direction, not necessarily the native candle's own up/down color. For example, a fair value gap direction is determined by the three-candle range relationship and the impulse filter, not by requiring the third candle itself to have a particular native color.
When more than one zone type confirms on the same candle, only one zone color is applied. The default Overlap priority is order block, then fair value gap, then price gap. Two alternative priority orders are available. Colors are not blended into an ambiguous intermediate shade.
Candle color source can use either the zone's fill color or its boundary color. Fill color is the default, so a colored confirming candle normally matches its rectangle. Boundary colors are independent, and they can be used for candle coloring even when the boundary lines themselves are disabled.
The two candle modes serve different purposes:
Actual candles is the default. It colors the native candle body and wick. The color remains after the associated zone later fills, breaks, is touched, ages out, or is evicted, so it should be read as a historical confirmation color rather than proof that the zone is still active.
Removable drawings is optional. It creates a body overlay and a thin wick overlay only for zones that are active, untouched, and age-visible. These are drawn after the zone boxes, allowing them to appear in front of zone fills and boundaries. They are removed on first touch, fill, break, age-out, or eviction. First touch removes the removable color even if the rectangle survives under Full fill. The scale guard does not suppress these overlays.
Removable body width and wick width are adjustable. Their positions and widths are reconstructed from candle prices and bar duration, so they are approximations of native candle geometry rather than the native candle objects themselves. On charts with unusual spacing or session breaks, you may prefer Actual candles or want to adjust the overlay width.
Pine has fixed drawing-layer groups. Removable candle boxes can be placed above zone boxes and boundary lines, but labels belong to a higher layer. Also, native chart candles are not individually reorderable against every script drawing. The removable overlay approach is used specifically to keep the colored body and wick readable over the zone rectangles without pretending that Pine offers unrestricted per-object layer control.
INDEPENDENT FILLS, BOUNDARIES, AND LABELS
The display controls are separated so that one visual decision does not force another.
For each zone type, you can independently control:
Whether its confirming candle is colored.
Whether its rectangle has a fill.
Whether its boundary is drawn.
Its bullish and bearish fill colors.
Its bullish and bearish boundary colors.
Its boundary style.
Its fill transparency.
The default fill transparency is 80 for all three types. In TradingView's transparency convention, a higher number means a more transparent fill. The defaults are meant to leave price action readable through the zones.
Boundary lines are off by default. Each type can use solid, dashed, or dotted boundaries. Boundary width and boundary transparency are shared controls, while the boundary colors and styles remain type-specific.
Optional zone labels are also off by default. When enabled, a label can show the zone type, direction, same-direction or opposite-direction overlap state, and whether its range contains the current point of control or intersects the value area.
Hovering a zone label provides additional context: its upper and lower boundaries, whether it is fresh or tested, its displacement body or gap height in ATR terms, the origin range high and low, the confirming candle high and low, the confirming candle's volume relative to its 20-period average, and its recorded touch count. These details are intended to make it easier to audit why a zone was accepted.
The label is contextual information, not a buy or sell instruction. A zone intersecting the value area is not automatically more likely to hold, and opposite-direction confluence is not automatically a reversal signal.
Active zones project 12 bars into the future by default. Active zone projection bars changes only the drawing's right edge. It does not change detection, removal, confluence, or alert logic.
THE AGE FILTER IS A VIEW, NOT A TIME MACHINE
Enable zone age filter is on by default, with Last 1 year selected.
The available views are intentionally limited to practical recent windows:
Last 1 month
Last 6 months
Current year
Last 1 year
Last 2 years
Last 1 month and Last 6 months are rolling windows approximated as 30.4375 and 182.625 days. Last 1 year and Last 2 years are rolling windows of 365.25 and 730.5 days. Current year uses the calendar year in the symbol's exchange timezone. Age is measured from the close time of the confirming candle to the chart's last bar, so rolling windows move forward as the chart advances.
The filter affects which stored zones are visible and included in age-dependent counts and zone alerts. Detection still runs across the loaded history, and the lifecycle of stored zones continues even when a zone is outside the selected view.
This separation has several practical consequences:
Widening the age view can reveal an older zone that is still stored and active.
It cannot restore a zone already removed because it filled, broke, or exceeded the storage limit.
It does not guarantee a removable candle overlay for every eligible historical confirmation.
It does not increase the amount of price history supplied by TradingView.
It does not make the fixed-lookback volume profile cover the entire selected age window.
In the default Actual candles mode, the selected age window determines which historical confirming candles are eligible to be colored, but those native colors are not erased when a zone later fills or is touched. In optional Removable drawings mode, candle colors are deleted when a zone ages out of the selected window.
For scalping, Last 1 month may be enough. For swing trading, Last 6 months is often a practical middle ground. For position trading, Current year, Last 1 year, or Last 2 years may be more appropriate. The age filter is not a backtest engine and does not reconstruct a sequence of historical dashboard states. It is a way to control which parts of the stored zone set are relevant to the current chart view.
WHY AN ORDER BLOCK CAN BE MISSING ON A HIGH TIMEFRAME
Order block detection runs on every bar of the loaded history. What you see depends on the age filter, invalidation rules, storage limits, and, only if enabled, the optional scale guard. The scale guard is OFF by default.
A measured example on a weekly Bitcoin series with 409 weekly candles between 2019 and 2026: the default rules detected 26 order blocks, 10 were still active at the last bar, and only 3 of those were born inside the default Last 1 year window. The other 7 blocks were detected, stored, and still valid, but the age filter hid them. Enabling Order blocks ignore the zone age filter draws all 10 without changing a single detection rule.
In earlier defaults, the enabled scale guard could hide distant blocks even after they passed the age filter. That guard is now OFF by default. With the current defaults, a stored, active block passing the age filter is not hidden because of its distance from recent price. If you explicitly re-enable Protect chart scale, Order blocks ignore the scale guard exempts OB rectangles from that optional distance filter; fair value gaps remain subject to it.
One year is about 52 weekly candles. Any block older than that disappears from a weekly chart while it is still open, which is why the summary panel can report a surprisingly small number of live blocks on a high timeframe. Lowering the ATR threshold does not fix that, because the blocks that are missing were never rejected by detection in the first place.
STORAGE AND DRAWING LIMITS ARE DELIBERATE
Pine allows a finite number of drawing objects. This indicator uses boxes for zone rectangles, profile rows, and removable candle bodies and wicks, so it manages them as a shared resource rather than allowing older objects to be garbage-collected unpredictably.
Exempting order blocks from the age filter or the scale guard changes visibility, not storage. The type limit still applies, so a chart with years of history keeps the newest 40 order blocks and evicts older ones. If a block you expect is neither drawn nor listed in the dashboard, check the storage limit before changing any detection input.
The default storage limit is 40 zones each for order blocks and fair value gaps. Price gaps have a separate and much larger limit, Maximum stored price gaps, default 200, because a lower timeframe generates far more gaps over the same calendar window. When a type exceeds its limit, the script removes older stored zones of that type, preferring ones already hidden by the age filter, and it never evicts the zone that was just confirmed.
The price gap limit is also bounded by the shared Pine drawing budget. The script reserves room for the configured profile rows and for the order block and fair value gap limits, then caps the effective gap limit so the total stays below Pine's 500-box maximum. The dashboard reports the effective limit rather than the requested one, so the two are never confused.
Removable candle marks are budgeted separately during each refresh. The script accounts for existing zone boxes, reserves space for the configured profile rows, and retains a safety margin below Pine's 500-box limit. It then draws qualifying marks from newer zones first.
Each removable candle requires both a body box and a wick box. Increasing the number of profile rows reserves more of the shared budget and can reduce the number of removable candles available. Increasing the number of stored zones can have a similar effect.
This is why the selected age window is not a promise of complete historical removable coloring. The script prefers a controlled recent display over silently exceeding the drawing limit and losing arbitrary objects.
The default Actual candles mode avoids using those body and wick boxes for candle coloring. It does not remove the need to manage active zone storage, but it is better suited to retaining historical confirming-candle colors across the loaded chart.
On very busy symbols or fast timeframes, reducing stored zones, profile rows, or the profile lookback can also reduce calculation and drawing work. These are practical load controls, not changes to the underlying definition of a qualifying candle pattern.
WHAT THE RIGHT-SIDE VOLUME PROFILE MEASURES
The volume profile estimates how reported volume was distributed across price during a fixed number of chart bars. The default lookback is 250 bars and the default number of price rows is 24.
Unlike a time-volume histogram below the chart, this profile organizes volume vertically by price and displays it horizontally. Longer rows represent more volume assigned to that price interval. The highest-volume row defines the point of control, or POC.
By default, Use lower timeframe volume is enabled. Where suitable intrabar data is available, each chart candle's volume is examined through lower-timeframe candles rather than simply distributing the entire chart-candle volume across its full high-low range.
The process has several steps:
Collect confirmed chart-bar slices within the configured lookback.
Request lower-timeframe data where a valid intrabar resolution is available.
Divide each source candle's range into fine internal price bins.
Distribute that candle's reported volume across the bins according to price-range overlap.
Aggregate those fine bins into the final profile rows.
Calculate the POC and value-area boundaries from the resulting row totals.
Draw the profile in the right-hand margin and update the dashboard.
The internal allocation is uniform across the portion of a source candle's range that overlaps a bin. It is not reconstructed from individual trades at their exact execution prices. Using lower-timeframe bars improves the price-location estimate, but it does not turn OHLCV data into a tick-by-tick order-flow record.
The profile's price range comes from the stored source slices. Final rows are equal-price intervals over that range; they are not automatically rounded to an exchange-specific row-size convention. Changing the number of rows changes the aggregation and can move the reported POC or value-area edges.
The POC line is drawn at the center of the highest-volume row. If multiple rows tie for the maximum, the lower-priced row encountered first is used. These details matter when comparing the output with another profile implementation.
This is an original Pine reconstruction designed to provide useful lower-timeframe context. It is not TradingView's built-in volume profile engine, not a tick-exact replica, and not a bid/ask delta profile.
UP VOLUME, DOWN VOLUME, AND THE VALUE AREA
In the default split profile, each populated row contains a down-volume segment and an up-volume segment. Down volume is placed on the left side of the row and up volume on the right.
A source candle contributes to up volume when its close is at or above its open. It contributes to down volume when its close is below its open. The candle's direction determines that classification; the script is not observing whether trades occurred at the bid or ask.
Calling these categories up volume and down volume is therefore more accurate than calling them genuine buying pressure and selling pressure. Every trade has both a buyer and a seller, and candle direction is only a classification rule.
The default level color is white. It is used for profile row outlines, the POC, the value-area high, the value-area low, and related dashboard text. POC value area and row outline color lets you change that color without changing the zone palette. The POC uses a thicker line than the dashed value-area edges so that it remains distinguishable.
The default value-area target is 70 percent of profile volume. Starting from the POC row, the calculation compares the adjacent rows above and below and selects the one with more volume. Equal-volume choices favor the row closer to the POC, with the upper side preferred if distance is also equal.
The expansion stops at the edge of the profile or before adding a row that would push the accumulated volume beyond the target. Because the profile uses discrete rows, the percentage is a target rather than a promise that the displayed area contains exactly that percentage. Boundary rows are not subdivided merely to hit the target precisely.
The value-area high is the upper edge of the highest included row. The value-area low is the lower edge of the lowest included row. These are profile-derived reference levels, not guaranteed support or resistance.
The optional Extend POC and VA lines across lookback setting extends the three levels leftward across the stored profile window. Otherwise, they remain confined to the profile area. The separate label switch can show POC, VAH, VAL, and the profile's bar count and data status.
ONE-SIDED AND ZERO-VOLUME ROWS
Two additional profile conditions can be highlighted in red.
A one-sided row is a populated row whose reported volume is dominated by one candle-direction category. The default threshold is 100 percent, meaning that the row contains only up-classified volume or only down-classified volume. Lowering the threshold also flags strongly dominant but mixed rows.
A zero-volume row is a price interval inside the profile's overall range that received no allocated volume in the selected lookback. It is shown as a small marker at the right edge rather than as a full-length volume bar.
These conditions have different meanings. A one-sided row has volume but lacks representation from the opposite candle-direction category at the selected resolution. A zero-volume row has no allocated volume in the reconstruction. Neither condition proves that no liquidity existed there or that price must react in a particular way on a revisit.
Both highlights are enabled by default and share one warning color. They take visual priority over the normal split or value-area coloring. The one-sided threshold, highlight switches, zero-volume marker width, and shared warning color are configurable.
The dashboard counts the underlying one-sided and zero-volume conditions even when their visual highlighting is turned off. This lets you hide the extra color without losing the summary count.
One-sided classifications depend on the available source resolution and row aggregation. A row that appears pure at one resolution may contain mixed source candles at a finer resolution. Treat the highlight as a description of the current reconstruction, not as a direct measurement of market participation.
INTRABAR RESOLUTION, FALLBACK, AND PROFILE STATUS
The default intrabar timeframe override is empty, which means Auto. The script chooses a common lower-timeframe resolution intended to fit the configured lookback within the intrabar data budget.
The default budget is 100,000 lower-timeframe bars. You can adjust it to match the data limit available under your TradingView plan. A larger budget can allow finer resolution across a longer lookback, but it also increases the amount of data the script processes.
A manual override is available when you want a specific intrabar timeframe. It must actually be lower than the chart timeframe and supported by the symbol's data and your plan. An invalid or non-lower selection falls back to the chart-bar estimate rather than producing a valid finer-resolution profile.
On charts of one minute or less, Auto may have no finer common resolution available and can use the chart-bar estimate. A supported manual seconds timeframe may provide intrabar detail on suitable second-based or minute charts, but availability is not universal.
The dashboard and optional profile title report the data mode:
LTF followed by a timeframe means the stored profile bars used lower-timeframe data.
LTF+est means the profile combines lower-timeframe slices with chart-bar estimates.
chart est means the displayed profile uses the chart-bar allocation method.
no volume means the selected data produced no usable positive volume.
no bars means there are no stored profile slices available for the calculation.
These status labels are important. A profile should not be compared with a native lower-timeframe profile without checking whether it actually received lower-timeframe data.
For a meaningful comparison with TradingView's built-in tools, align the covered price-history range, row count, value-area percentage, and volume classification as closely as possible. A fixed lookback of 250 chart bars is not automatically the same range as a manually selected Fixed Range profile or the current Visible Range profile.
Even with matched settings, differences can remain because of source resolution, intrabar availability, row boundaries, allocation method, POC tie handling, and value-area expansion. The objective is a closer and more informative estimate than simple chart-candle spreading, not a claim of exact equality.
READING THE DASHBOARD
The dashboard is enabled by default at the bottom left, with small text and a solid black background. Its position and text size are adjustable.
There is one row for each combination of zone type and direction: bullish and bearish order blocks, fair value gaps, and price gaps. The row names use the corresponding zone colors so that the table remains visually connected to the chart.
The columns report:
LIVE: active zones that pass the selected age view.
TESTED: the subset of those live zones that has recorded a retest.
NEAREST: the price of the nearest zone edge for that type and direction. If the close is already inside a qualifying zone, the close is shown. The cell is blank when no qualifying zone exists.
PROFILE: how many zones of that type and direction intersect the current value area. A nonzero count is shown with a VA prefix.
The dashboard also shows the current POC and value-area boundaries, same-direction and opposite-direction cross-type overlap pairs, the number of zones containing the current close, the number of stored profile bars, and the profile's data status.
The bottom line summarizes the close-confirmed profile status, one-sided row count, zero-volume row count, selected age view, and the price gap storage state as gaps stored/limit, with a dropped count when gaps have been evicted.
The two price gap rows carry a diagnostic tooltip. Hover the GAP BULL or GAP BEAR row label to see the stored gap count, the effective storage limit, how many gaps are hidden by the age view, how many were dropped by the storage limit, how many were suppressed by the fair value gap deduplication rule, and whether the scale-guard exemption is active. This is the fastest way to identify why a specific unfilled gap is not on the chart.
Several distinctions are useful when interpreting these numbers:
LIVE is not a count of every historical signal.
TESTED is not a separate population added to LIVE; it is a subset.
NEAREST is a price, not a distance in ticks or a probability score.
A value-area overlap count is not a confluence-pair count.
AT PRICE counts qualifying zones containing the close, so overlapping zones can contribute more than one count.
SAME DIR and OPPOSITE count pairs of active, age-visible zones from different types, not the total number of zones involved.
Scale-guard visibility does not remove a zone from these internal counts.
The dashboard is a compact state summary. It does not rank setups, estimate win rates, or issue trade instructions.
CONFLUENCE MEANS OVERLAP, NOT CONFIRMATION OF A TRADE
The script distinguishes same-direction confluence from opposite-direction confluence.
Same-direction confluence means that active zones from different types overlap in price and point in the same direction. Opposite-direction confluence means that active zones from different types overlap but have opposing directions.
The overlap must have positive height. Sharing only a boundary is not enough. Zones of the same type are not paired with each other for these dashboard counts.
The default same-direction fair-value-gap and price-gap deduplication reduces duplicate counting when one displacement satisfies both definitions. It does not prevent an order block from overlapping a gap, and it does not suppress opposite-direction relationships.
Confluence alerts are event alerts associated with a newly confirmed, age-visible zone. They are not continuously repeated on every candle merely because two old zones still overlap. The dashboard, by contrast, reports the current overlap-pair state.
A same-direction overlap can help organize context, but it can also result from several measurements of the same move. An opposite-direction overlap can identify an area where different displacement signals meet, but it does not tell you which side will prevail.
The profile adds another reference layer. A zone containing the POC or intersecting the value area may deserve attention within your own process, but that intersection is not independent proof of future support, resistance, or direction.
CLOSE CONFIRMATION AND REPAINTING BEHAVIOR
Wait for candle close is enabled by default.
With this setting, new zones and zone lifecycle decisions are processed on confirmed candles. A pattern that appears temporarily during a live candle is not accepted as a new confirmed zone until that candle closes.
The alert conditions are also gated to confirmed candles. This remains true even if you disable the visual wait setting. Optional combined alert messages use the once-per-bar-close alert frequency.
Turning off Wait for candle close enables intrabar previews. Those previews can appear, change, or disappear before the candle closes. They should not be treated as stable historical signals, and the live preview may not match what is ultimately confirmed.
The volume profile stores confirmed source slices independently of this visual preview choice. Its latest levels can still change as new confirmed bars enter the fixed lookback and older bars leave it. A POC or value-area touch alert therefore refers to the currently calculated profile level, not an immutable level that was known at some earlier date.
Close confirmation removes one important source of signal repainting. It does not make market outcomes predictable, eliminate data-feed revisions, or turn the volume profile into an exact historical record of tick volume.
For normal use and historical review, leave Wait for candle close enabled.
ALERTS
The script includes 23 individual alert conditions, grouped around zone creation, retests, removal, confluence, and profile-level touches.
New-zone conditions are available for:
Bullish and bearish order blocks.
Bullish and bearish fair value gaps.
Bullish and bearish price gaps.
Any newly confirmed zone.
First-retest conditions are available for any zone, each individual zone type, and bullish or bearish zones. Removal conditions are available for any invalidated zone and for each type separately. There is also a condition for a close entering a stored zone from outside it.
Additional conditions cover same-direction confluence, opposite-direction confluence, a touch of the POC, a touch of the value-area high, and a touch of the value-area low.
To create an individual alert, select the indicator in TradingView's alert dialog and choose the relevant condition. Once per bar close is the appropriate frequency for the intended confirmed-event workflow.
The optional Send combined alert() messages setting is off by default. When enabled, it sends a dynamic message containing the events detected on a closed candle, along with the symbol, timeframe, and closing price. To receive those messages, create an alert using Any alert() function call.
Do not enable overlapping individual alerts and the combined message path unless you intentionally want more than one notification for the same event.
Several event details matter:
First retest means the first qualifying intersection recorded for a stored zone, not the first touch of a price level across all history.
A close-enter event requires the previous close to have been outside the zone and the current close to be inside it.
A single closed candle can produce multiple different event types, but an individual condition does not enumerate every affected zone in its static message.
New-zone, first-retest, invalidation, and close-enter events require the affected zone to pass the selected age view. Confluence is evaluated when an age-visible new zone overlaps another active zone of a different type.
Hiding a rectangle through the scale guard does not by itself disable its underlying zone events.
Profile levels are recalculated as the profile window advances, so their touch conditions are tied to the current profile state.
Alerts are notifications of defined chart conditions. They are not order-execution instructions or recommendations to enter a position.
PRACTICAL WAYS TO CONFIGURE THE CHART
For a relatively clean current-market workspace, start with the defaults: transparent zone fills, no boundaries or labels, candle coloring off, candle mode set to Actual candles, the profile enabled, and the dashboard at the bottom left. Enable Scale price chart only on the chart itself.
If you want native candle confirmation colors, enable Color candles only for the types you actually use and leave the mode on Actual candles. Expect those colors to remain historically after the zone later fills, breaks, or is touched. Read them as confirmation events, not as proof that the zone is still active.
If you want a current-zone-only candle visual, switch to Removable drawings and enable the relevant Color candles switches. Expect those colors to follow active, untouched, age-visible status and the available drawing budget rather than act as a historical archive. First touch removes the removable color even when the rectangle remains visible under Full fill.
Choose the age window to match your trading horizon. Last 1 month can suit scalping, Last 6 months can suit swing trading, and Current year, Last 1 year, or Last 2 years can suit position trading. The default is Last 1 year.
If you prefer an outline-only chart, disable the rectangle fills and enable boundaries for the desired types. Candle coloring can remain enabled independently. If you want candles to use the boundary palette, change Candle color source to Boundary color.
If fair value gaps and price gaps feel redundant, leave same-direction deduplication enabled and choose the definition you prefer. If you are comparing the two methodologies, disable deduplication temporarily and remember that overlapping same-direction results may describe the same displacement.
If an unfilled price gap is missing on one timeframe but present on another, check the price gap diagnostic tooltip first. A nonzero dropped count means the storage limit is too low for that timeframe. A nonzero age-hidden count means the age view is too narrow. A nonzero dedupe count means a same-direction fair value gap is intentionally taking precedence. If all three are zero and the gap is still absent, confirm that Price gaps ignore scale guard is enabled and that Enable price gaps is on for that chart.
If older support zones are missing, first confirm that Protect chart scale is OFF. This applies to both order blocks and fair value gaps. If the candles then look compressed, right-click the price scale and enable Scale price chart only; do not hide the desired zones to repair scaling. Next check the selected age window, storage limits, and whether the zone has actually filled or broken. One year is about 52 weekly candles. The optional Order blocks ignore the zone age filter switch can reveal older stored blocks without changing detection. Other indicators may also use different detection rules or higher-timeframe zones; identical results are not guaranteed. Do not loosen confirmation or retain invalidated blocks merely to increase the number of rectangles.
If the chart is too busy, reduce the number of zone types, lower the storage limits, raise the ATR thresholds, or disable optional labels and boundaries before changing the underlying definitions. If removable historical marks are the issue, switch candle modes rather than repeatedly widening the age filter.
If the profile is the main focus, align its lookback and row count with the comparison range, check the data-status field, and use the profile labels only when you need exact level prices on the chart. Extend the POC and value-area lines when studying reactions across the lookback; keep them confined to the right margin when you want a cleaner price area.
For fast second-based charts, start with a modest lookback and avoid enabling every optional visual at once. The indicator is designed to support second-based timeframes where the required data is available, but execution time still depends on the symbol, history, intrabar resolution, and TradingView plan. If a one-second chart reaches an execution limit, a 15-second chart is a practical fallback. Reducing profile lookback, row count, stored zones, or disabling the profile can also reduce load.
DEFAULT CONFIGURATION AT A GLANCE
The main defaults are:
All three zone detections enabled.
Order block range based on wicks, with a 0.65 ATR displacement-body threshold, a maximum impulse run of 3 bars, and a maximum origin cluster of 3 bars.
Order block confirmation set to Close beyond origin, and order block invalidation set to Close beyond opposite edge.
Order blocks follow the zone age filter by default. The separate age exemption is off. Protect chart scale is OFF, so its distance filter does not hide OBs or FVGs.
Order block volume filter disabled.
Fair value gap minimum size of 0.10 ATR and a middle-candle impulse threshold of 0.65 ATR.
Price gaps based on wick separation, with a minimum size of 0.05 ATR.
Price gaps exempt from the scale guard, with a separate storage limit of 200 gaps.
Full-fill removal for both gap types.
Same-direction FVG and price-gap deduplication enabled, preferring the fair value gap.
Fourteen-period ATR used for the displacement and gap-size reference.
Twelve-bar active-zone projection.
Up to 40 stored order blocks and 40 stored fair value gaps.
Age filter enabled with Last 1 year selected; available views are Last 1 month, Last 6 months, Current year, Last 1 year, and Last 2 years.
All three candle-color switches disabled.
Candle mode set to Actual candles. Removable drawings remains optional, with body width at 70 percent and wick width at 2 percent of a bar when selected.
Candle color source set to Fill color.
Overlap priority set to order block, then fair value gap, then price gap.
Zone fills enabled at 80 transparency.
Zone boundaries and labels disabled; boundary width is 1 pixel and boundary transparency is 0.
Protect chart scale OFF. Its optional margin remains 10 percent of the recent 100-bar range when enabled.
Input values hidden from the chart status line through display.data_window on every input; all controls remain editable in Settings then Inputs.
If drawings compress the candles, right-click the price scale and enable Scale price chart only.
Volume profile enabled with lower-timeframe data preferred.
Automatic intrabar resolution and a 100,000-intrabar budget.
Profile lookback of 250 chart bars, 24 rows, and a 70 percent value-area target.
Profile width of 55 bars and an offset of 10 bars.
One-sided and zero-volume highlighting enabled.
Profile level and bar-count labels disabled.
Dashboard enabled at the bottom left with small text.
Wait for candle close enabled.
Combined alert messages disabled.
Every input includes a tooltip explaining its purpose. The settings are intended to be explored without needing to infer what a control changes from its name alone.
SCOPE, ORIGINALITY, AND LIMITATIONS
Order blocks, fair value gaps, price gaps, and volume profiles are established chart-analysis concepts. The originality of this implementation is in how they are combined and managed: independent visual channels, explicit confirming-candle selection, removable versus native candle coloring, same-event FVG/gap deduplication, cross-type confluence, an age-aware working set, a right-margin-only profile, and a shared drawing-budget strategy.
The implementation does not reuse another author's script or library. Its detection rules and reconstruction method are described above so that users can evaluate what the drawings actually represent rather than relying on a vague smart-money label.
The main limitations are equally important:
Order blocks are inferred from price and optional volume conditions, not observed institutional orders. The origin cluster and impulse-run controls are heuristic approximations of the last opposite-direction candle or cluster before a strong move.
Fair value gaps and price gaps are geometric range relationships, not guarantees of a future fill or reaction. The FVG impulse filter reduces some weak geometric gaps, but it does not turn the pattern into a validated trading signal.
The profile is an intrabar or chart-bar allocation estimate, not tick-exact volume at price.
Up/down volume is candle-direction volume, not bid/ask order flow.
Native visible-range selection and this script's fixed chart-bar lookback are not automatically identical.
Removable candle history is intentionally limited by active-zone status and drawing resources.
Actual candle colors can remain after a zone is no longer active and must be interpreted accordingly.
Completed zones are removed rather than maintained as a full historical mitigation database, unless order block invalidation is set to Keep until aged out. Blocks kept that way are context, not confirmed live zones, and the dashboard counts them as active until they age out or are evicted.
Letting order blocks ignore the age filter and the scale guard increases how much of the stored history is painted. It does not increase how much history TradingView supplies, and it can pull the price scale toward distant levels.
Price gap detection uses the candles of the current chart timeframe. The storage and display fixes make an unfilled gap on that timeframe persist consistently, but the script does not transplant a gap detected on one timeframe onto another.
Intrabar availability, second-based data access, loaded history, and execution limits depend on the instrument and TradingView plan.
No setting or combination of overlaps constitutes a validated trading edge by itself.
Use the indicator as a structured way to inspect displacement, unfinished price ranges, and volume distribution. Combine it with your own market context, risk controls, and testing rather than treating a color or dashboard count as a stand-alone decision system.
This publication is for chart analysis and educational use. It does not provide financial advice, guarantee results, or recommend any particular trade.
DISCLAIMER & RISK DISCLOSURE
This indicator is provided for informational and educational purposes only. It does not constitute financial or investment advice or a recommendation to buy or sell any financial instrument.
Trading involves risk, and losses can exceed your initial investment, particularly when using leveraged products. Always make your own trading decisions and manage your risk accordingly.
Indicator signals, zones, profiles, and alerts are based on technical calculations and market data. They are not guarantees of market direction, accuracy, or profitability. Past performance does not guarantee future results.
The indicator is provided free of charge, as is, without guarantees of accuracy, reliability, or uninterrupted availability. The author is not responsible for trading losses or damages resulting from its use, to the extent permitted by applicable law.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.