VWAP Band Fills with Anchored VWAP MT4
- Indicators
-
Kazuma Uezono
MQL5 / MQL4 / Pine Script v6 developer and active trader.
Seller on the MQL5 Market (indicators for MT4/MT5).
Services:
- TradingView Pine Script to MT5/MT4 conversion (bar-by-bar matching, with tester report)
- MT4 to MT5 migration - Version: 1.2
VWAP Band Fills with Anchored VWAP MT4 brings the VWAP of TradingView to MetaTrader 4. If you use TradingView's built-in "VWAP", you will find the same inputs here (Anchor Period, Source, Offset, Bands Calculation Mode, Bands Multiplier #1 to #3, Hide VWAP on 1D or Above), the same formula (Pine ta.vwap) and the same colors - plus an anchored VWAP that starts wherever you drag a vertical line.
THE FORMULA
Within each anchor period, bar by bar:
VWAP = sum(source x tick volume) / sum(tick volume)
deviation = sqrt( sum(tick volume x source^2) / sum(tick volume) - VWAP^2 )
Band #n = VWAP +/- deviation x multiplier #n (Percentage mode: VWAP x 1% x multiplier)
Everything restarts at the first bar of the next period.
WHAT YOU CAN SET
Setting | Choices | Default
Anchor Period | Session, Week, Month, Quarter, Year, Decade, Century | Session
Source | open, high, low, close, hl2, hlc3, ohlc4, hlcc4 | hlc3
Offset | 0-500 bars | 0
Bands Calculation Mode | Standard Deviation, Percentage | Standard Deviation
Band #1 / #2 / #3 | on/off, multiplier 0-100 | #1 on x1, #2 off x2, #3 off x3
Fill bands | on/off, opacity 1-100% per band | on, 5% (as on TradingView)
Anchored VWAP | on/off, first position in bars back | off, 100 bars
Sunday bars | Auto, merge into Monday, separate day | Auto
MT4 NOTES - PLEASE READ
1. Tick volume only. MT4 has no real volume, so the VWAP is always weighted by tick volume.
2. Fills are drawn as thin histogram bars between the bands, because MT4 has no fill style. The bar width follows the chart zoom (up to 5 px), so at high zoom you may see small gaps between them. The fill colors are pre-mixed with your chart background and follow it when you change the background.
3. Colors come from the inputs. VWAP, band and fill colors and widths are set in the Inputs tab; the Colors tab is not used.
4. To keep the candles visible above the fills, "Chart on foreground" is switched on while fills are shown. The original setting is stored on the chart and restored when the last copy is removed (a fill-using tool of the same series shares it; the setting comes back only when none of them is left). Set "Keep candles in front of the fills" = false if you prefer to manage it yourself.
5. Inputs have no group headings in MT4; they appear in the order listed at the end.
ANCHORED VWAP
Set "Show anchored VWAP" = true. A dotted vertical line is placed 100 bars back. Drag it to a swing point, a news bar or any bar you like; when you drop it, the orange anchored VWAP is redrawn from that bar. It uses the same source and tick volume, without bands. One line serves all copies on the chart and is removed together with the last copy.
HOW CLOSE IT IS TO TRADINGVIEW
- Same formula. The values still differ a little, because your broker's tick volume is not TradingView's volume data. Expect a close match, not an identical one.
- Day and week boundaries are your MT4 server's 00:00 (weeks start on Monday). On the usual GMT+2 / GMT+3 servers, 00:00 equals 17:00 New York, so forex and gold sessions begin at the same moment as on TradingView.
- BTC and other 24-hour symbols: TradingView begins the session at 00:00 UTC. With a server in another time zone the session begins a few hours earlier or later, and the Session VWAP values differ from TradingView.
KNOWN LIMITS
- The newest (forming) bar moves with each tick. Closed bars stay as they are, except the anchored VWAP after you move its line.
- Right after attaching, the short name may show "probe#..." for a moment while the indicator checks whether it runs on a chart. It returns to normal by itself.
- Under iCustom it draws nothing and changes no chart setting; the anchored VWAP then starts "bars back" bars before the newest bar. Attached to another chart by an EA with ChartIndicatorAdd, it may draw nothing - attach it by hand or with a template.
- No objects and no messages in the Strategy Tester. No DLLs, no files, no internet access.
- An analysis tool only: no alerts, no signals, no trading, no promised result.
iCUSTOM BUFFERS
6 VWAP | 7 Upper Band #1 | 8 Lower Band #1 | 9 Upper Band #2 | 10 Lower Band #2 | 11 Upper Band #3 | 12 Lower Band #3 | 13 Anchored VWAP.
Buffers 0-5 hold the fill bars; do not read them. Band values are filled even for hidden bands; EMPTY_VALUE where there is no value. (The MT5 edition uses different numbers.)
INPUTS (MT4 ORDER)
Hide VWAP on 1D or Above = false; Anchor Period = Session; Source = hlc3; Offset = 0; Sunday bars = Auto; Bands Calculation Mode = Standard Deviation; Show Band #1 = true; Multiplier #1 = 1; Show Band #2 = false; Multiplier #2 = 2; Show Band #3 = false; Multiplier #3 = 3; VWAP color = #2962FF; VWAP width = 1; Band #1 color = #4CAF50; Band #2 color = #808000; Band #3 color = #089981; Band line width = 1; Fill bands = true; Fill opacity = 5; Keep candles in front of the fills = true; Show anchored VWAP = false; First anchor: bars back = 100; Anchored VWAP color = #FF9800; Anchored VWAP width = 2; Language = Auto.
Out-of-range values stop the indicator from loading, with the reason in the Experts log.
SUPPORT
Help with installation, settings and bug reports via MQL5 messages. I do not answer questions about market direction or specific trades.
The MT5 edition (a separate product) and other tools by the same author are listed on my seller profile.
TradingView is a trademark of TradingView, Inc. This product is not affiliated with, sponsored by or endorsed by TradingView, Inc.
