OPEN-SOURCE SCRIPT
Actualizado

Split VWAP

2 745
What it does

Split VWAP cuts every bar horizontally at the session VWAP and draws it as two candles at the same position: one spanning the low up to VWAP, one spanning VWAP up to the high. Each partial takes the bar's open and close clamped into its own range, and a share of the bar's volume proportional to its height. Where VWAP sits at or beyond a bar's extreme, one partial collapses to zero height and the other takes the whole bar and all of its volume; the collapsed one is hidden by default.

A single candle gives you four prices and one volume total, but says nothing about how that activity was distributed relative to the session's average price. Splitting the bar at VWAP and attributing volume to each side makes that distribution visible.

How the colouring works

Each partial is coloured from two changes, both measured against the previous bar's partial on the same side of VWAP: the change in attributed volume, and the change in clamped close.

In the default mode, "Volume hue OKLCh", each change gets a channel of its own. The volume change moves the hue along a continuum — red (
#ea6c5c, hue 29) when it fell, green (
#05b28d, hue 171) when it held, blue (
#7b8efa, hue 274) when it rose. The price change moves the lightness: lighter when the close rose, darker when it fell.

All three anchors sit at an OKLCh lightness of 0.680 and hold as much chroma as their hue can carry at that lightness, capped at 0.16 so the ends do not shout over the middle. Green is the quiet one because green simply cannot hold as much. OKLCh is used rather than HSL because HSL treats lightness as a function of the hue you happen to be on, so a fixed magnitude renders brighter on some hues than others; in OKLCh, lightness, chroma and hue move independently.

Bodies are hollow when the partial's clamped close is above its clamped open, and solid otherwise. A dot marks the VWAP level itself, coloured by the same scheme applied to the whole bar.

Three further modes are included — Quadrant intensity, Bilinear blend and Polar OKLCh. These read the two changes as four corner colours instead of two channels, one per sign combination, and use magnitude to drive chroma and opacity. Every corner and anchor colour is an input.

Scaling

Every series is normalised against the dispersion of its own bar-to-bar changes: 2.5x the mean absolute change over a lookback, which is roughly two standard deviations for a well-behaved distribution but far less sensitive to the occasional volume spike.

Measuring each series against itself matters more than it sounds. A partial carries only a fraction of the bar's volume, so normalising its volume change against the whole bar's average volume compresses that axis and leaves the colour field stuck near the middle. In the other direction, half the ATR is smaller than a typical close-to-close move, so the price axis clips on a large share of bars. It also gives the VWAP-pinned partial a usable scale: when a bar closes above VWAP the lower partial's close is pinned to the cut, so its only movement is VWAP drift — small in absolute terms, but perfectly legible against its own dispersion.

The consequence worth holding on to while reading the chart: the colour says how unusual a change is for that partial, not how large it is in absolute terms.

Setup

The script paints over the chart's native candles, but Pine cannot hide the chart symbol itself. For the cleanest result, right-click the chart, open Settings -> Symbol, and uncheck Body, Borders and Wick.

Settings worth knowing

Gradient mode — the four schemes described above.
Price lightness span — how far a full-strength price change moves the lightness off the anchor, in OKLCh lightness. Default 0.16. A wider span reads more decisively but costs colour at both ends, because sRGB is widest in the middle and narrows toward black and toward white. Rather than let the channels clip, the requested chroma is fitted to whatever the lightness and hue can actually carry, so bright bars are pastel and dark bars are saturated.
Response ramp — how quickly the colour responds as a change grows. 1.0 is proportional; the default 0.6 reaches most of the response earlier, so only genuinely quiet bars stay washed out.
Price change scale / Volume change scale — the lookbacks for the two normalisers.
Transparency at no change — how far quiet bars recede. Lower it if the quiet end reads too faint.

Limitations

Volume attribution is proportional to segment height, not measured from intrabar data. It is a shape-preserving approximation, not a true intrabar volume profile.
The VWAP is session-anchored, so the split level resets at each session boundary and the first bars of a session sit close to it.
On a strongly trending session, price can run far enough from the session VWAP that one partial collapses on most bars and the display degrades toward ordinary candles. That is expected behaviour rather than a fault.
The script requires a symbol that reports volume, and raises a runtime error on symbols that report none.

Originality

This is original work. The bar splitting, the volume attribution, the per-partial normalisation, and the OKLCh colour handling — including the OKLab conversions and the chroma fitting, neither of which Pine provides — are implemented from scratch. No third-party code is reused.
Notas de prensa
Bars now keep their whole wick.

The bar was cut at VWAP into two halves, and the same cut was used both to
measure each half and to draw it. When VWAP sat outside the candle body, one
half collapsed to a flat dash and took the wick on that side with it, so a bar
could be drawn with the wrong low. Those two jobs are now separate, and every
price in a bar shows the color of its own side of VWAP.

What changed

- Bars keep their full wick above and below VWAP. The "Hide zero-height
partials" setting is gone, because there is nothing left to hide.

- The two split candles are now opaque, so they no longer blend into a darker
band where they overlap. The VWAP dot still fades with the size of the change.

- The price channel is a two-way split rather than a gradient. A partial whose
close rose renders in the anchor color exactly; one whose close fell or held
is the same hue, one step darker. Direction is what that channel is for, and
grading it by size made small moves ambiguous.

- New "Unchanged volume" default, #36b364. It sits midway between the
falling-red and rising-blue anchors, so a rise and a fall of the same size
travel the same distance around the hue wheel: 122 degrees each way, where it
was 142 and 103. It also holds more color than the old teal, which was the
washed-out one in the middle of the ramp.

- The status line shows the VWAP level and nothing else.

Settings

- Removed: "Hide zero-height partials", "Response ramp".

- Renamed: "Price lightness span" is now "Price down darkening"; "Transparency
at full change" is now "Split candle transparency"; "Transparency at no
change" is now "Dot transparency at no change".

- New defaults: "Up-body fill transparency" 50 to 80; "Unchanged volume"
#05b28d to #36b364.

Worth knowing

- Colors you set by hand in the Style tab will reset. The two candle plots were
renamed, because which side of VWAP each one draws now varies bar to bar.

- The first bars of a chart render in the dark band. The price-change scale needs
its lookback to fill, 20 bars by default, and until it does the change measures
as zero, which counts as down.
Notas de prensa
Update - price line and label coloring to match current close color.
Notas de prensa
Better real-time coloring
Notas de prensa
Now uses OKLCh library

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como, asesoramiento o recomendaciones financieras, de inversión, de trading u otro tipo, proporcionadas o respaldadas por TradingView. Obtenga más información en Condiciones de uso.