VWAP
VWAP is the average price weighted by volume, accumulated from an anchor instead of over a fixed window. That one difference decides everything about it: measured on synthetic series, the day's first bar follows a price step completely and its 288th bar follows 0.325% of it, so the same node with the same settings is a different indicator in the morning than in the evening.
- Anchor
- Day boundary (configurable)
- Bands
- ±2 weighted σ
- Step response
- ≈ 1/n into the session
示意性 — 合成数据,非实时报价。
What VWAP tells you
VWAP is the average price everyone who traded since the anchor actually paid, weighted by how much traded at each price. It is not a moving average with a long period — it is a cumulative average that starts over, and that is the whole of the difference. A 20-period average always holds 20 bars; VWAP holds one bar at the open and hundreds by the close, so its sensitivity falls away as the session goes on. Measured on synthetic series, a price step moves the day's VWAP by almost exactly 1/n where n is the bar's position in the session: 100% on the first bar, 3.35% on the thirtieth, 0.325% on the 288th. The practical consequence is that crossings cluster early — in the same measurements the first half of the day held 2.0 to 5.2 times as many as the second half — and that the distance between price and VWAP grows steadily, because the line has stopped being able to follow.
- Not an MT5 built-in — and, unlike the others, it has no period to hand to a handle
- The anchor is the setting that matters; the band multiple is a distant second
- It gets slower every bar of the session, by construction rather than by choice
- 1 At the anchor, reset. Typical price = (H + L + C) / 3
- 2 Accumulate Σ(price × volume) and Σ(volume) bar by bar
- 3 VWAP = the ratio; the bands are ±Mult × the volume-weighted σ
显示公式与计算详情
MetaTrader 5 has no VWAP, and there is nothing to build one from — a handle needs a period, and this has none. What the Builder generates accumulates from the anchor on every tick:
tp[i] = (H[i] + L[i] + C[i]) / 3 <- typical price
v[i] = tick volume of bar i <- 0 is treated as 1
VWAP = sum(tp*v) / sum(v) <- from the anchor to this bar
sigma = sqrt( sum(v*(tp - VWAP)^2) / sum(v) )
upper = VWAP + Mult*sigma, lower = VWAP - Mult*sigma
The sums are taken from the anchor forward, so the count of bars in them grows through the session and resets at the boundary:
walk back from `shift` until the calendar day changes <- at most `max_bars` bars
(or until the bar's time of day falls before `start_min`, for a session anchor)
then accumulate forward from there to `shift`
That walk is the one thing that has to be got right. It stops at the day boundary, so on H1 it ends after a couple of dozen bars whatever the cap is set to — but on M1 a day is 1440 bars, and a cap below that silently turns the session average into a rolling one. Measured against the full-day value on synthetic M1 days, a cap of 200 bars was off by a median of 62.8 pips, 500 by 47.4, 1000 by 21.8, and 1440 by nothing.
The weighting is worth measuring rather than assuming. Subtracting the plain average of the same typical prices gives an identity:
VWAP - mean(tp) = Cov(tp, v) / mean(v)
which held to 1.8e−15 over 60 measured sessions. When volume says nothing about price the two are the same number, and measured with independent volume the difference came to 0.279, 0.921 and 0.794 pips on three synthetic series — 0.505%, 0.575% and 0.573% of each series’ own daily range. It scales with how variable the volume is: raising its coefficient of variation from 0.1 to 2.0 took the median difference from 0.125 to 2.566 pips.
What does dominate is the anchor. Stepping price by 100 pips at bar n of the session and measuring the effect on the day’s VWAP:
n = 1 2 5 10 30 60 120 288
100 50.5 19.8 9.08 3.35 1.80 0.878 0.325 <- % of the step
1/n = 100 50 20 10 3.33 1.67 0.833 0.347
The excess over 1/n at small n is the volume weighting; the shape is arithmetic, and no parameter changes it. The consequences show up in the things a strategy actually counts: measured over 200 synthetic days per series, the first half of the day held 12.24, 11.44 and 8.21 crossings of the line against 5.57, 5.78 and 1.57 in the second half, while the mean distance from price to the line went the other way — 7.39 to 12.92 pips, 22.58 to 40.60, and 18.28 to 45.37. Both are the same fact seen twice: by the afternoon the line has stopped being able to follow.
信号
VWAP 提供的可回测信号 — 及每个信号适合的市场状态。
VWAP Cross
Builder 可实现Side as a Filter
Builder 可实现Anchored to an event
人工判读MT5 实现
MetaTrader 5 实际计算和绘制的内容——本页每条规则的依据。
缓冲区
| 索引 | 缓冲区 | MT5 中的绘制方式 | 存放内容 |
|---|---|---|---|
| 0 | MAIN_LINE | Line | There is no VWAP buffer to read, because there is no VWAP indicator in MT5 — and unlike the other custom indicators on this hub, there is also nothing to build one from. An indicator handle is created with a period; VWAP has no period. It accumulates from an anchor, so the number of bars in it changes on every bar and resets at the boundary. The generated EA reads iHigh, iLow, iClose and iTickVolume directly and folds the sum itself; the mean, the weighted standard deviation and the bands are local variables, and only the one line the node is set to is published. |
平台说明
最佳适用场景 / 谨慎使用
没有任何指标具有普适优势。以下是 VWAP 发挥作用的场景 — 以及可能误导的场景。
最佳适用场景
- Intraday timeframes, where a session is a meaningful number of bars
- As a reference level other rules are measured against, rather than as an entry
- Instruments and hours where tick volume is a fair proxy for participation
- The middle of a session — early, the bands have no width; late, the line barely moves
谨慎使用
- Treating it as a slow moving average; it has no period and its speed changes hourly
- The first bars after an anchor, where the band width is zero or near it
- Weekly or multi-day anchors on low timeframes — an M1 week is 10,080 bars to fold
- Assuming the volume weighting is doing the work; measured, it moves the value about 0.5% of the day's range
构建 VWAP 策略
将信号接入进场和出场规则,然后导出可编译的 MT5 EA — 无需编写代码。
- Three VWAP nodes on the same daily anchor — the lower line, the upper line and VWAP itself
- The close of the last closed bar, crossed against each of the two outer lines
- A Compare against VWAP itself, so the entry is the reversion and not the follow-through
- Cross up through the lower line and still below VWAP → Close short, then Open Buy · SL 80 / TP 40
- Cross down through the upper line and still above VWAP → Close long, then Open Sell, mirrored
将 VWAP 与其他指标组合
单一指标很少独立有效。这些组合弥补了 VWAP 的盲点。
VWAP + Bollinger Bands
- VWAP lower band
- Bollinger lower band
- And gate
No template holds both. Add a Bollinger node beside the VWAP nodes and join the two conditions with an And gate before the entry.
打开 Builder →VWAP + Opening Range Breakout
- Opening range break
- Price against VWAP
- And gate
Add an Opening Range Breakout node, compare its signal against zero, and gate it with a Compare of price against a VWAP node.
打开 Builder →VWAP + ADX
- ADX below 25
- VWAP band reversion
- And gate
Add an ADX node with a Compare against 25 and join it to the And gate ahead of the entry.
打开 Builder →参数
在您自己的货币对和时间框架上验证的起始值 — 非保证设置。
| 参数 | 默认值 | 建议测试范围 | 功能说明 |
|---|---|---|---|
| Line | VWAP itself | VWAP itself / Upper band / Lower band | Which of the three lines this node publishes. One node emits one line, so the template uses three of them on the same anchor. That is also the cost: each one folds the session independently, because the Builder has no way for two nodes to share an accumulation. |
| Band multiple | 2 | 0.1–10 | How many volume-weighted standard deviations the band sits from the line. Unused when the line is VWAP itself. Unlike a Bollinger band this σ is measured over the whole session so far, so it is small and unstable at the start of a session and settles as bars accumulate — the multiple does not change that shape, it only scales it. |
| Anchor time | 0 (daily) | 0–1439 minutes from midnight | Where the accumulation restarts each day. Zero means the day boundary. Any other value makes it a session VWAP that starts at that time of day and reports nothing before it. This is the setting that decides what the indicator is; everything else is presentation. |
| GMT offset | 0 | −12 to +14 hours | Shifts the day boundary, because the broker's server day is rarely the day you mean. It applies to both the anchor and the boundary test, so moving it moves the whole session rather than just the start. |
| Lookback cap | 1500 | 1–5000 | The maximum number of bars the EA will walk back looking for the anchor. It has to reach it. An M1 day is 1440 bars, M5 is 288, M15 is 96 and H1 is 24, so 1500 covers a daily anchor on every intraday timeframe. Measured against a full-day baseline on synthetic M1 series, a cap of 1000 was off by a median of 21.8 pips, 500 by 47.4 and 200 by 62.8 — and none of those raise an error. The loop stops at the boundary, so a high cap costs nothing on a timeframe that reaches the anchor sooner. |
| Shift | 1 | 0–100 | Which bar the node reports. The template uses 1 so decisions are made on a closed bar. Shift 0 is worth avoiding here because the current bar's tick volume is still growing, so the weight of the newest bar — and with it the line and both bands — changes on every tick. |
| Timeframe | Current | Current / M1–MN1 | Which series the accumulation runs on. This changes the indicator more than it changes most: a session is 1440 bars of M1 and 24 bars of H1, so on H1 the whole 1/n decay happens across a single trading day's worth of a dozen readings, while on M1 the line is effectively frozen by mid-session. |
初始预设
市场示例
VWAP 有效的场景、失效的场景,以及过滤器如何改变结果。
The reversion from the lower band
Mid-session, with the band fully opened out. Price has run below the session's average and past two weighted standard deviations of it, then closes back inside while still under VWAP — the entry is the return, not the continuation after it.
The touch in the first bars after the anchor
The session has just restarted, the band has almost no width, and price crosses it on a move that means nothing. This is the structural weak point of any band built on an accumulation, and it is why the early session is worth excluding rather than tuning.
The reversion the gate refused
Price crosses back up through the lower band but has already climbed past VWAP itself. The gate rejects it because the reversion has happened — what is left is the follow-through, which is a different trade with a different distribution.
FAQ
- Is VWAP a built-in MetaTrader 5 indicator?
- No. There is no iVWAP, and unlike Hull or QQE it cannot be folded from another indicator's handle either — a handle needs a fixed period and VWAP has none. The Builder's node reads iHigh, iLow, iClose and iTickVolume and accumulates from the anchor inside the generated EA. Nothing needs to be installed in the terminal.
- Why does the node have a lookback cap?
- Because the EA walks back to the anchor on every tick, and it needs a limit. The important part is that the limit has to be long enough: an M1 day is 1440 bars, so the default is 1500. Cut it short and you get a rolling average presented as a session VWAP, with no error — measured, a 500-bar cap on M1 was off by a median of 47.4 pips.
- Does the volume weighting actually change much?
- Less than the name suggests, and the amount is exact rather than estimated: VWAP minus the plain average of the same typical prices equals Cov(price, volume) / mean(volume). With volume independent of price the difference measured 0.279 to 0.921 pips on three synthetic series — about 0.5% of each day's range. It grows in proportion to how variable the volume is, and to how strongly it co-moves with price.
- Why does VWAP stop responding later in the day?
- Because it is a cumulative average, so the newest bar is one of n rather than one of a fixed window. Measured, a price step moves the day's VWAP by almost exactly 1/n: 100% on the first bar of the session, 3.35% on the thirtieth, 0.325% on the 288th. This is not a setting — it is what the indicator is — so the answer is to anchor differently or to trade a different part of the session, not to change a parameter.
- Can I anchor it to something other than midnight?
- To a time of day, yes: the anchor is set in minutes from midnight, with a GMT offset for the broker's server day, so a session VWAP is one field. Anchoring to an event — a release, a gap, a swing high — is not something the node does, because it takes a clock time rather than a condition.
- Why are there three VWAP nodes in the template?
- One node publishes one line, and the flow needs the lower band, the upper band and VWAP itself. Each folds the session independently because the Builder has no mechanism for two nodes to share an accumulation. It is cheap in absolute terms — a few thousand floating-point operations per tick — but it is the reason the template has three of what looks like the same node.
- Why 2 standard deviations, and why do the bands look narrow at the open?
- Two is convention rather than a measured optimum, and it scales a width that is mostly determined by how far into the session you are. The weighted standard deviation of a single bar is zero, so at the anchor both bands sit on the line and open out from there. Entries that depend on a band touch are close to meaningless in the first bars of a session at any multiple.
- Can I build this without coding?
- Yes. The template is three VWAP nodes on the same daily anchor, the closed bar's Close, two Cross nodes against the bands, two Compare nodes against VWAP itself, two And gates, two Close nodes wired ahead of the entries, and Open Buy / Open Sell on a fixed lot. The anchor, band multiple, lookback cap and GMT offset are set in the Builder; the compiled EA exposes the stop distances, lot size and maximum spread as inputs.