OPEN-SOURCE SCRIPT

Multi-Anchor_VWAP & Deviation Bands [AFD]

584

ekran görüntüsü

Three anchored VWAPs on one chart, with the price zones where they agree shaded in for you.

WHAT IT IS
An anchored VWAP shows the average price everyone has paid since a moment you pick - the gap open, the earnings bar, the swing low that started the move. That is where buyers from that moment sit at break-even, which is why price keeps coming back to it.

One anchor answers one question, so most traders end up dropping three or four by hand and dropping them again every session. This runs three at once: each anchors where you want, each carries its own deviation bands, and the script shades the zones where two of them line up.

THE CONFLUENCE SHADING
ekran görüntüsü

ekran görüntüsü

Look at this first. It does work you would otherwise do by eye.

When your session VWAP and your weekly VWAP arrive at the same price, that price is being watched by two different groups at once. Those levels tend to matter more than either line alone, and with three curves running they are easy to miss.

The script shades between any two layers that come within your tolerance of each other - on by default at 8 points, and it checks all three pairings, 1 to 2, 1 to 3 and 2 to 3.

Set the tolerance in ticks, points, currency, or percent of price. Trading more than one instrument, use percent: it is the only one you never have to re-tune when you change symbol.

THE ANCHORS
Ten per layer, mixed freely.

*Set and forget - Session, Week, Month, Quarter, Year. Re-anchors itself every new period.
*Pick the bar yourself - Manual timestamp. Type a date and time. This is the one for an earnings bar, a Fed day, a gap.
*Let the chart find it - prior-session high or low, confirmed swing high or low. These follow structure so you are not re-anchoring by hand.

Defaults are session and week, the pairing most intraday traders want.

Two things about the structure anchors look broken if nobody warns you:

*The curve shows up late. A swing is not a swing until enough bars print after it. At swing length 10 the line appears 10 bars after the pivot, then draws itself back to the pivot where it belongs.

*It never rewrites history. When a newer pivot confirms, the layer re-anchors from there forward. Everything already drawn stays put.

THE BANDS
ekran görüntüsü

Up to three per layer, each with its own multiple from 0.0 to 10.0. They tell you how stretched price is from that anchored average. Four ways to measure the stretch:

*Standard deviation (default) - how far price usually strays from this average. The classic VWAP band.
*ATR - sized by recent range instead, so the envelope opens up in fast markets.
*Percent of VWAP - a fixed percentage. Same shape on any instrument.
*Standard error - starts wide on a fresh anchor and tightens as the window fills.

Type the multiples in, or load a Fibonacci preset: 0.382 / 0.618 / 1.0 for the inner set, 1.0 / 1.618 / 2.618 for the outer.

IT TELLS YOU WHEN IT CANNOT DO ITS JOB
An anchored VWAP can quietly stop being volume-weighted, or stop covering the window you think it does. This one writes it on the layer's own label, and these notes cannot be switched off - they show even with line labels turned off:

*"UNWEIGHTED (no volume)" or "N bars unweighted" - the feed gives no usable volume, so this is a plain average, not a VWAP. Most indices and some spot forex. This is the one that matters.
*"one bar per session" / "two-bar window" - a prior-session anchor on a daily or higher chart, where it can only ever span two bars.
*"clipped to the draw depth" or "segment past the 5,000-bar buffer, not drawn" - the line starts in mid-air because it hit a drawing limit, instead of pretending it reaches further back than it does.
*"(retro)" - a structure anchor, found after the fact. "RTH" - regular hours only, which changes what the average is.

A clean chart carries none of these. One showing up means something you could not otherwise see has happened.

SETTING IT UP
*Add it. Layer 1 takes the session, layer 2 the week, and the shading marks where they agree.
*Want one clean line? Switch layer 2 off. Want a third timeframe? Switch layer 3 on.
*Anchoring to an event: Manual timestamp, then the bar's date and time. Anchoring to structure: a confirmed swing or a prior-session extreme.
*Running two or three layers, turn on "Show anchor" - once bands overlap, a label naming its starting bar beats one that just says "L2".

84 inputs in seven groups, and anything that does not apply greys itself out.

ALERTS
One alert: VWAP crosses, band crosses, both, or off. Create it in TradingView with "Any alert() function call". It only fires when a bar closes, never mid-bar, so you are not woken up by a wick that gets taken back.

WORTH KNOWING BEFORE YOU USE IT
*Structure anchors draw late. That is the trade for anchoring to something only confirmable in hindsight.
*History runs 5,000 bars, and draw depth caps how far a line reaches. Hit either and the label says so instead of the line quietly stopping short.
*On "Regular hours only" the ATR bands still measure across every bar on the chart, so they use a wider set of bars than the average does.
*"Current window only" hides older curves once a repeating anchor has cluttered things up. Fills, the prior-window level and the confluence shading switch off in that mode.
*These bands are this script's own definition, not a claim of equivalence with anyone else's bands of the same name.
*Not usable in the Pine Screener - the manual anchor needs a time input, and the Screener substitutes its default instead of reading it, so it would anchor from the wrong bar without telling you.
*One symbol, one timeframe. No higher-timeframe or cross-symbol requests.

WHAT MAKES IT DIFFERENT
*Three genuinely independent anchors - own anchor, own source, own colours, own bands. Not one anchor with presets.
*Confluence shading across all three pairings, in four choices of unit.
*It anchors to bars it can only recognise after the fact - prior-session extremes and confirmed swings - and back-fills the curve to them. A running-total VWAP cannot reach backwards like that without starting over.
*It states its own failure modes on the chart instead of returning a number that is not what its name says.
*Four band bases behind one band definition, and Fibonacci ratios as presets on the levels you already have rather than as extra clutter.

Open source under the Mozilla Public License 2.0.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.