Anchored VWAP Channel Indicator: 30-Bar VWAP With Bands

Written by Dominic Walsh · Published · Last updated

The anchored vwap channel indicator draws a volume weighted line with a band on each side of it. VwapPeriod sets how many bars feed the line, and Deviations sets how far the bands sit from it. Buy and Sell arrows mark the bars where price crosses back through the middle. The window rolls forward with each new bar rather than holding one fixed starting point.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 5: VWAP, Upper, Lower, Buy, Sell
Alerts popup, push notification, email, sound
Inputs 9

What the Anchored Vwap Channel Indicator draws on the chart

VWAP (gold) is the volume weighted average of the last VwapPeriod bars.

Upper (blue) sits Deviations standard deviations above that line.

Lower (blue) is the matching band underneath it.

Buy (lime, code 233) prints below the low when the close crosses back above the middle line.

Sell (red, code 234) prints above the high on the opposite cross.

  • VWAP: line, gold, width 2
  • Upper: line, deep sky blue, width 1
  • Lower: line, deep sky blue, width 1
  • Buy: arrow, lime, width 4, arrow code 233
  • Sell: arrow, red, width 4, arrow code 234
EURUSD H1: the anchored vwap channel indicator with Upper and Lower bands and a Buy arrow.
EURUSD H1: the anchored vwap channel indicator with Upper and Lower bands and a Buy arrow.

How the Anchored Vwap Channel Indicator calculates its values

A rolling weighted average

The middle line is built from a rolling window rather than a fixed anchor. Each bar price is weighted by its tick volume across the last VwapPeriod bars, and the window moves forward with the chart.

That makes it behave much like a weighted moving average. A truly anchored version would hold one starting bar and never release it, which is not what this code does.

Building the bands

Band width comes from a standard deviation call over the same VwapPeriod window, using closing prices and simple averaging. Deviations multiplies that figure.

Upper is the middle line plus the result and Lower is the middle line minus it. Both widen when the market gets volatile and pull in when it calms down.

Where the arrows come from

The cross test compares two bars. The previous close has to have been at or below the weighted line as it stood then, and the current close above the line now.

Sell mirrors that. ArrowOffsetPoints then pushes the marker clear of the candle by a fixed number of points.

How to read the signals

Price outside Upper or Lower means the last VwapPeriod bars have stretched away from their weighted centre.

A Buy arrow marks a close back above the middle line, not a touch of Lower.

Bands narrowing means the deviation over the window is falling, which happens through quiet stretches.

The middle line reacts faster than a plain average of the same length whenever volume is uneven across the window.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

Alerts cover popup, push, email and sound on each cross of the middle line. The bar time is checked first, so one cross gives one alert.

Every Anchored Vwap Channel Indicator input

Core settings

Setting What it does Default
VwapPeriod VwapPeriod sets how many bars feed both the weighted line and the deviation figure. It defaults to 30. 30
Deviations Deviations multiplies the standard deviation to set band width. It defaults to 1.6, so widen it towards 2.0 for fewer touches. 1.6

Display settings

Setting What it does Default
ArrowOffsetPoints ArrowOffsetPoints is the cosmetic gap between an arrow and its candle, 35 points by default. 35

Alert settings

Setting What it does Default
EnableAlerts (see inputs panel) on
EnablePopup (see inputs panel) on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
Inputs panel for the anchored vwap channel indicator showing VwapPeriod and Deviations.
Inputs panel for the anchored vwap channel indicator showing VwapPeriod and Deviations.

Settings that fit your chart

The screenshot uses EURUSD H1. A 30 bar window on H1 covers a little over a trading day, which suits pairs that rotate around an intraday mean. On H4 and daily the same window stretches across weeks and the bands turn slow. Below M15 both bands and the middle line react to almost every candle.

When the Anchored Vwap Channel Indicator fails

The name says anchored but the window rolls. Anyone expecting a line fixed to a session open or a chosen swing gets a moving average instead.

Deviation bands assume the recent spread describes the next move. A gap or a news candle goes straight through them and widens the bands afterwards, not before.

In a trend price can ride Upper for many bars while the middle line drags along behind. Crosses back through the centre then arrive late.

Tick volume does the weighting. Through a thin session that weighting means less than it appears to.

Copy the compiled Anchored Vwap Channel Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Download the Anchored Vwap Channel Indicator for MT4 and MT5

The zip holds the compiled Anchored Vwap Channel Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

Is the VWAP here anchored to a fixed starting bar?

No. The code recalculates over the last VwapPeriod bars on every candle, so the window rolls forward. That makes it a rolling weighted average rather than a line anchored to a session open or a chosen swing. Set VwapPeriod higher if you want it to behave more slowly.

What does Deviations at 1.6 do to the Upper band?

It multiplies the standard deviation measured over the same window. At 1.6 the Upper band sits 1.6 deviations above the middle line. Raising it towards 2.0 pushes both bands out and price reaches them less often. Lowering it brings them in and produces more touches.

Does a touch of Lower print a Buy arrow?

No. The check looks at the middle line, not the bands. It needs the previous close at or below the weighted line and the current close above it. A candle can trade right through Lower with no arrow appearing, as long as it does not close back over the centre.

Why does the Upper band widen after a fast move?

The deviation call reads the last VwapPeriod closes. A large candle only enters that window once it has printed, so the reading rises afterwards. The bands then stay wide until that candle drops out of the window again, which takes VwapPeriod bars.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Anchored Vwap Channel Indicator as one input. Always backtest before trading live.

Category: this is part of our Volume collection. Thus, truly, yet, browse more Volume for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment