Dynamic Swing Anchored VWAP runs on MT4 and MT5. It finds the swing that the current move
started from, drops an anchor there, and draws a volume weighted line forward from it.
When the swing changes, it drops a new anchor and starts again.
There are three ways to draw that line and one setting picks between them: two different
anchored VWAPs, and a Bollinger band. Same swings, same colours, different line.

What the number actually is
The swing is a running extreme. A bar becomes the swing high the moment it's the
highest of the last 50 bars, and the swing low the same way. Direction is simply whichever
of the two happened more recently: if the last new high is newer than the last new low,
the market is going up, and the anchor is that last low.
That matters more than it sounds. Nothing to the right of the bar is consulted, so the
direction never has to be taken back once it's shown. Swing tools built on fractals need
bars on both sides before they'll commit, which is why their labels appear in the past.
The line is where the name gets interesting. From the anchor forward:
alpha = 1 โ exp(โln2 / APT)
p := (1โalpha)ยทp + alphaยท(hlc3 ร volume)
vol := (1โalpha)ยทvol + alphaยทvolume
line = p / vol
Price times volume and volume are each smoothed, then divided. APT, the Adaptive Price
Tracking setting, is a half life in bars: at the default 20, a bar's influence is half
gone after 20 bars and a sixteenth gone after 80.
The two VWAPs, and why both are here
A textbook anchored VWAP sums every bar since the anchor with equal weight. The decaying
one halves that weight every APT bars. They are not variations on a theme; they behave
so differently that arguing about which is right is pointless, so both ship.
| Cumulative (textbook) | Decaying (default) | |
|---|---|---|
| Weight of the bar at the anchor | The same as today's | Halved every APT bars, so about 3% after 100 |
| Where it sits | Well away from price, flattening as the leg ages | Close to price, tracking the move |
| What it answers | What did everyone pay since this swing | Where has the money been trading lately, restarted at this swing |
| How often price touches it | Rarely, and it means something when it does | Often, the way price touches a moving average |
| What it turns into on a long leg | A shelf | A volume weighted moving average |
On the two gold pictures in this listing, taken on the same bars: the cumulative red leg
from the 24 August high glides down above price for the whole fall and is never
touched. The decaying red leg over those same bars sits on price and is touched repeatedly.
One is a level; the other is a mean.
Pick by what you want it for, not by which is more correct: something to lean on, take
cumulative; something price returns to, take decaying and let APT set how tightly it hugs.
Three ways to draw the anchored level
Anchored level picks what gets drawn from the swing.
Anchored VWAP (decaying) is the default and the line in the first picture.
Anchored VWAP (cumulative) is the textbook one. APT does nothing in this mode,
because there is nothing to forget.
Anchored Bollinger band takes the band on the anchor's side instead. Anchored at a
low, you get the lower band; anchored at a high, the upper one. It sits further from
price and moves in steps rather than a curve.


What it doesn't move
Only closed bars are evaluated. The bar still forming never gets a value, and the work
runs once per new bar rather than once per tick.
Because the swing test looks only backwards, a leg is never redrawn somewhere else later.
A leg does appear retroactively when it's born, running from its anchor to the current bar
in one go, and after that it grows one point per bar and the earlier points don't change.
Alerts are off out of the box. Set Notification type and one fires when a new anchor is
placed, and only once the indicator has been running, so loading it onto a year of history
gives you a year of drawings and no alerts. MT5 also takes a Telegram bot token and
channel id; the MT4 build has platform alerts and email only, which is what MQL4 gives you.

What it can't do
Volume here is tick volume. There's no central exchange in forex, so what MetaTrader
calls volume is a count of price updates. It correlates with real activity well enough to
weight an average and it is not the same thing. On a symbol where your broker reports real
volume you'll get real volume; on gold and on currency pairs you won't.
Only the last eight legs are kept. Legs overlap, because a new one is anchored at a
swing that's already behind the current bar, and an indicator buffer holds one value per
bar. Eight of them rotate, so the ninth oldest disappears. At the default swing period
that's several hundred bars of history, which is more than fits on a screen, but scroll
far enough left and the lines stop.
There's no minimum swing size. A bar only has to be the highest of the last 50 to
count. In a tight range that happens often, so the anchor moves often and you get short
legs. Raising Swing Period is the fix, and it's the first setting I'd change.
Adapt APT by ATR ratio is stronger than it looks. It divides the half life by the
ATR ratio raised to Volatility Bias, so at the default bias of 10 a ratio of 1.15
shortens the half life fourfold. Clamped to 5โ300 bars, but leave it off at first.
You won't find a win rate table in this listing, and I'd be careful with any indicator
listing that has one. It marks swings and draws a line from them.
Honestly, the fiddliest part of building the MT4 side had nothing to do with the maths.
MQL4 numbers its bars backwards, so every stored index had to become a count from the
oldest bar instead of a count from the newest. Store a leg the other way and it slides one
bar to the left every hour, quietly, while the chart still looks plausible.

Questions you'll have
Does Dynamic Swing Anchored VWAP repaint? No. Only closed bars are evaluated, the
swing test never looks to the right of the bar it's judging, and once a leg's points are
drawn they don't move. A new leg does appear all at once, running back to its anchor,
because that is the bar it was anchored to.
Is this a real VWAP? Both are here. Anchored VWAP (cumulative) is the textbook one,
weighting every bar since the swing equally. The default weights recent bars more, with a
half life you set. See the table above for how differently they behave.
Why do two lines overlap sometimes? Because a new leg is anchored at a swing behind
the current bar, so it draws over bars the previous leg already covered. That's the tool
showing you both readings, not a bug.
Why did my old lines disappear? Only the last eight legs are kept. Scroll right or
raise Swing Period for longer legs.
What are the best settings for Dynamic Swing Anchored VWAP? Change Swing Period
first, not APT. More swings than you want means the period is too low; a line that
ignores obvious turns means it's too high. APT is how tightly the line hugs price once
the swing is chosen.
Can I get Telegram alerts? On MT5, yes, via the bot token and channel id in the
notification block. The MT4 build does platform alerts and email only.
MT4 or MT5? Both, and your subscription covers both. Same formula, same defaults, one
download each.
Support
Message me through the site with a screenshot showing the chart, plus the symbol and
timeframe. That's usually enough for me to tell you what happened. Updates are included
for as long as your subscription is running.
Analysis tool. It places no trades and makes no profitability claim. Past price
behaviour is not a guide to future price behaviour.