OPEN-SOURCE SCRIPT

MTF VWAP + POC Fan

462
### What it does

Seven fixed-lookback windows on one anchor timeframe. Each window draws a VWAP curve — where the average participant's cost sits over that span — and can optionally draw a POC, the single price bin inside that same window that traded the most volume.

Same window, two different questions:

- **VWAP** — what the average participant paid
- **POC** — where participation actually concentrated

A dashboard reads the seven VWAP endpoints and scores the structure they form.

Default ladder is a daily one: **21 / 63 / 126 / 189 / 252 / 378 / 756** bars — roughly one month through three years. The anchor timeframe is configurable, so the same ladder on Weekly becomes five months through fourteen years.

### Why fixed lookbacks instead of swing anchors

Anchoring a VWAP at a swing high or low answers a real question — "what has been paid since that event" — but those anchors collapse into each other as windows grow. If price has not exceeded its three-month high, then the six-month, twelve-month and three-year highs are all the same bar, and several rungs draw one curve.

Fixed-lookback anchors cannot collide. The bar 252 back and the bar 378 back are always different bars, so seven rungs always mean seven distinct windows. That property is what makes a seven-horizon fan worth drawing at all.

### Reading the curve correctly

This is the part most multi-window VWAP scripts leave ambiguous, so it is worth being explicit.

At its **right edge**, VW252 equals the VWAP of the last 252 anchor-TF bars. That endpoint is the number.

The **tail behind it is not a rolling 252-bar series.** Every point on the drawn curve is the accumulation from the origin that is 252 bars back *today*, so the midpoint of the line is roughly a 126-bar average. The curve does not show what VW252 read on those past dates — on any past date it was anchored 252 bars before *that* date, at a different origin entirely.

The tail is one accumulation path from today's origin. Read historical crossings with that in mind.

### How the VWAP is calculated

Standard volume-weighted mean of the source (default HLC3) from the window's origin bar to its end bar, accumulated over **chart** bars. Origins are located on the anchor timeframe, then resolved to the exact chart bar by binary search.

When volume is missing or zero the engine substitutes 1.0, and tracks the substitution rate **per window**. Two different failures hide under one symptom:

- Missing on nearly every bar (synthetic symbols, some indices) — every bar weighs the same, so the curve is an *unweighted* mean of the source. Usable if you know that is what you are reading.
- Missing on a handful of bars in a real feed — a bar weighing 1.0 against neighbours weighing millions is not averaged in, it is effectively *dropped*. Still a proper volume-weighted mean, over a slightly smaller sample.

Curves whose own window exceeds the warning rate are suffixed with `*` and counted on the dashboard.

### How the POC is calculated

The window's high-low range is divided into bins, and each bar's volume is allocated **in proportion to how much of that bar's range overlaps each bin.**

The obvious shortcut — splitting a bar's volume equally across every bin it touches — is wrong at the edges: a bar with 2% of its range in one bin and 98% in the next would contribute 50/50. Since the POC is an argmax rather than an average, that error does not wash out. It can hand the win to the wrong bin.

Fully covered interior bins are accumulated with a difference array (one increment at the low edge, one decrement at the high edge, resolved in a single prefix sum) rather than a per-bin loop, which keeps the cost at O(bars + bins).

Three deliberate constraints:

**Resolution is capped at one bin per tick.** The bin-count input is a *maximum* resolution, not permission to invent sub-tick precision. If a window's whole range spans forty ticks, a hundred bins would put several bins inside one tick and the argmax would be choosing between prices that cannot trade. The reported level is also snapped to the instrument's tick grid, because an unrounded one-tick bin from 10.00 to 10.01 reports 10.005.

**Bin width is per window.** Each window divides its *own* range, so a P756 bin can be several times wider than a P126 bin. Two POCs landing on the same price are not confirming each other to the same tolerance. Each label's tooltip prints its bin width — read the level as the centre of that band, not as a price.

**POC is suppressed, not flagged, when volume is substituted.** A VWAP with missing volume degrades into an unweighted mean, which is still a usable number. A profile with missing volume becomes a bar-*count* histogram, whose peak answers where price spent the most bars regardless of size traded. That is a different statistic wearing the POC's name, so above a threshold nothing is drawn and the dashboard names the reason.

### Why POC is drawn forward, not backward

By default a POC starts at the last calculated bar and extends right. It is not drawn back across the window it was computed from.

A VWAP tail is a continuous accumulation with a value at every bar. A POC is a single number recomputed every bar with no value anywhere but now. Drawing both back to the same origin would make one line a genuine path and the other a snapshot impersonating one — the same visual gesture carrying two different truth-values, which teaches the wrong reading and creates hindsight support that was never there.

`Window + Forward` is available when you want to see the span, with the understanding that the backward segment is decoration.

Related: a POC **jumps**. It is an argmax, so when a different bin overtakes the leader the level teleports. A POC that sat at 70k yesterday and prints 62k today is not a data error — it is a window with two shelves close in volume. The single line cannot tell you that, which is the honest limitation of showing a POC without its profile.

### The visual grammar

- **Colour = horizon identity**, fixed per rung, never reassigned when other rungs are toggled. 252 is gold whether seven rungs are on or two.
- **Solid, width 2 = VWAP**
- **Dashed, width 1 = POC**, same colour as its VWAP

There is deliberately no horizon-based transparency and no colour-by-price-position. Fading short horizons fought the pairing and restyled everything on every toggle. Colour-by-price-position was redundant with the chart itself — whether a VWAP is above or below price is visible by looking at it — and spending the colour channel on it meant colour was unavailable for identity.

The palette is a cool progression (aqua → light blue → blue → lavender → **gold at 252** → violet → deep purple) so the fan reads as one instrument rather than seven unrelated indicators. Gold breaks the ramp deliberately, because 252 is the horizon most often referenced. Green and red stay out of the palette on purpose: they belong to the candles, and to the dashboard.

The script declares `scale=scale.none` so a distant 756-bar VWAP cannot drag the price axis and compress the candles you are actually trading.

### Seven VWAPs, three POCs

All seven VWAPs ship on. Seven ordered curves read fine, and where they bunch is itself information.

POCs are opt-in per rung, defaulting to **126 / 252 / 756** only — medium-term, annual, multi-year. Seven horizontal levels crowd a chart in a way seven curves do not. P189 and P378 are one click away. Global `Show VWAPs` and `Show POCs` switches let you inspect either family alone.

### The structure dashboard

A 0–100 read on where price sits relative to the fan and whether the fan is ordered.

```
STRUCT 88
P>VW 7/7
STACK +5/6
BIAS STRONG BULL
P>POC 3/3
```

**Price position — 50 points.** How many VWAP endpoints price is above, as a fraction of the drawn rungs, times 50.

**Stack — 50 points.** The adjacent-pair ordering, short over long. Each of the six adjacent pairs scores +1 when the shorter window sits above the longer, −1 when inverted, 0 when they are inside an equality tolerance. Raw range −6 to +6, rescaled to 0–50.

The dashboard shows the **signed raw total** (`+5/6`, `0/6`, `−4/6`) rather than a count of bullish pairs, because that signed number is literally what enters the score. Five bullish plus one tied and five bullish plus one inverted are different fans that a bullish-pair count would render identically.

The tolerance is normalised by the **anchor timeframe's** ATR, not the chart's — otherwise the same daily fan would classify two near-identical VWAPs as tied on a 130m chart and ordered on a 39m one, purely because the chart-TF ATR is smaller.

| Score | Bias |
|---:|---|
| 85–100 | Strong Bull |
| 70–84 | Bull |
| 55–69 | Bull Lean |
| 45–54 | Neutral |
| 31–44 | Bear Lean |
| 16–30 | Bear |
| 0–15 | Strong Bear |

`P>POC` is context only and does **not** enter the score. A volume concentration is a location, not a direction.

### What the score is not

Worth stating plainly, because a 0–100 number invites more confidence than this one has earned.

**The two components are not independent.** Price above every VWAP and a perfectly stacked fan are largely the same market condition seen twice — in a sustained one-way move both max out together, in chop both sit near their middles. Treat 0–100 as one structural reading measured two ways, not as a composite of separate evidence. The extremes are easier to reach than a two-component construction suggests.

**Stack ordering is partly mechanical.** These windows are nested — VW21's bars are a subset of VW63's, which are a subset of VW126's — so in any monotonic trend the ordering *follows* from the trend rather than confirming it independently. Where it earns its keep is at turns, when the short end inverts while price position is still high. That divergence between the two rows is more informative than the combined number.

**It is a step function.** With seven rungs, price position moves in jumps of 7.14 and stack in jumps of 4.17. The reading can cross the entire neutral band between two bars without ever printing a value inside it. Small changes are not drift.

**The score is withheld when horizons are missing.** Unless every enabled rung produced a VWAP and no two rungs share a lookback, STRUCT and BIAS print `—` and a `check` row names the reason. Normalising over whatever horizons happened to exist would let a two-horizon symbol print `STRUCT 100 / STRONG BULL`, indistinguishable at a glance from a seven-horizon reading.

Practical consequence: on a symbol without 756 anchor bars of history, the score stays blank until you turn VW756 off. That is deliberate. Disabling the rungs a symbol cannot support makes the reading an explicit statement about which horizons you are using.

### Confirmed Bars Only

With this off (default), windows extend through the current chart bar and update live.

With it on, **both ends** move to completed bars: lookbacks shift back one anchor bar, and all accumulation — VWAP, POC, the dashboard's reference price, and the stack tolerance's ATR — stops at the last chart bar of the last completed anchor candle. The fan then stops moving intraday entirely, which is what the switch should mean. Labels still sit at the chart's right edge while the values belong to the last completed candle; that gap is the point of the switch.

### Settings worth knowing

- **Anchor Timeframe** — the timeframe every lookback is counted in. Must be at or above the chart timeframe. Every anchor timeframe wants its own ladder; the defaults are a daily one.
- **Profile Bins** — maximum POC resolution, capped at one bin per tick.
- **Stored Chart Bars** — an origin must fall inside stored history or its rung is dropped, not approximated. Default 10,000 because 756 daily bars on a 39m chart is roughly 7,500 chart bars.
- **Dim rungs far from price** — optional, off by default. Fades a rung whose VWAP is beyond a set ATR distance. The whole rung dims together so a pair never splits into one bright line and one faint one. Try `scale.none` alone first.
- **Update Mode** — Live redraws every tick, which is necessary rather than wasteful: Pine destroys drawing objects created on an uncommitted tick, so on the forming bar a redraw every tick is the only way curves stay on screen. On Bar Close draws only on committed executions. Use it, or turn POCs off, if the profile passes trip the calculation time limit.
- **Show Diagnostics Panel** — full accounting of rungs, drawn objects and failure reasons. Off by default; anything genuinely wrong still surfaces on the dashboard's `check` row.

### Known properties

**Chart-timeframe sensitivity.** Origins come from the anchor timeframe, but accumulation uses chart bars, so the same daily setup gives slightly different values on a 39m chart than a 130m one. For the VWAPs this is second order — averaging washes out coarse bucketing. For the POC it is not: an argmax does not average, and a coarse bar spreads its volume uniformly across a range it never traded uniformly through. Expect the POC to shift by a bin or two between chart timeframes, more on symbols with frequent wide-range bars.

**Duplicate lookbacks are counted, never merged.** Two rungs set to the same number draw two identical curves in two colours, which looks like two horizons agreeing and is really one horizon entered twice. The dashboard flags it and withholds the score.

### Why VWAP and POC live in one script

They are computed from the same window definition. Splitting them would mean two indicators independently re-deriving identical origins, and would make it impossible to guarantee that P252 and VW252 cover exactly the same bars — which is the entire point of reading them as a pair. The dashboard reads only the VWAPs; the POC family is excluded from it precisely because it answers a non-directional question.

---

*This is a structural reference tool, not a signal generator. Nothing here produces entries, exits or alerts, and no part of it is a claim about future prices. Published open source so the calculations can be checked rather than taken on trust.*

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.