Skip to content

Indicators

VWAP Indicator: Formula, Anchors and Forex Volume Rules

The VWAP indicator displays volume-weighted average price: the sum of price multiplied by volume, divided by total volume since a defined anchor. A session VWAP restarts at its session boundary; an anchored VWAP starts at a specified event or bar. The price source, volume feed and reset rule determine the result. On forex or CFD feeds using tick volume, the weights count price updates rather than market-wide traded volume.

Illustrative VWAP indicator cover with price observations, different volume weights and a visible anchor separating accumulation periods.
Price, volume and the anchor jointly determine VWAP. Changing any one of them changes the calculation.

VWAP at a glance

Scroll horizontally to read every column.

Input or feature What must be specified
Price source Trade prices or a bar-based source such as (high + low + close) ÷ 3.
Volume The selected feed's traded volume or tick volume, with its units identified.
Anchor The first included observation and the event that resets the accumulated totals.
Session The included trading hours and the timezone defining their boundaries.
Meaning A weighted average over the chosen observations, not an entry instruction or a future price target.

TradingView's VWAP documentation describes the cumulative price-times-volume calculation and selectable anchor periods.[1] The indicator rules library compares VWAP with averages and oscillators that use different inputs.

What is the VWAP formula?

VWAP = Σ(priceᵢ × volumeᵢ) ÷ Σ(volumeᵢ), from the anchor through the current observation

Here i identifies an included observation. Each price is weighted by that observation's volume. The formula requires a positive total volume and valid price and volume inputs. A zero-volume observation adds zero weight when its price is valid; an unavailable volume value is a different data problem.

For a bar-based calculation, a common price source is the typical price:

Typical price = (high + low + close) ÷ 3

TradingView documents this source for VWAP.[1] Multiplying a bar's typical price by its volume treats that one price as representative of the bar. The result need not equal a calculation using every individual trade's actual price and size.

A session VWAP accumulates observations until a reset. A fixed-window moving average instead drops an old observation as a new one enters its window. Both the weighting and the inclusion rule matter; an identical line label does not establish an identical calculation.

Worked example: calculate VWAP and then reset the anchor

Illustrative values, not a recommendation or market data. Three bars within one anchor interval have the following selected price values and valid volume weights. Volume units are consistent across all rows.

Selected price Volume Price × volume
100 10 1,000
102 30 3,060
106 10 1,060
Total 50 5,120

VWAP = 5,120 ÷ 50 = 102.4. The unweighted average is (100 + 102 + 106) ÷ 3, approximately 102.67. The middle observation receives more weight in VWAP because its volume is larger.

Now add a bar with selected price 104 and volume 50. Its contribution is 104 × 50 = 5,200. The result depends on whether the anchor resets:

  • Same anchor: (5,120 + 5,200) ÷ (50 + 50) = 10,320 ÷ 100 = 103.2.
  • New anchor at this bar: discard both prior totals, giving 5,200 ÷ 50 = 104.
Illustrative VWAP reset comparison: a new bar with selected price 104 and volume 50 produces VWAP 103.2 when prior totals remain, or 104 when the anchor resets.
Illustrative arithmetic. The new bar is identical in both cases; the anchor changes which earlier observations remain in the calculation.

Without a reset, the new bar contributes 50 ÷ 100 of the total weight. Its price is 104 − 102.4 = 1.6 above the previous VWAP, so the VWAP rises by 0.5 × 1.6 = 0.8, reaching 103.2.

VWAP change = new volume ÷ new total volume × (new price − previous VWAP)

This update identity applies when the existing totals remain in use. Accumulated volume changes how much one additional observation can move the average; it does not create a directional forecast.

What is the difference between session VWAP and anchored VWAP?

Session VWAP restarts at a recurring session boundary. An anchored VWAP starts at a specified bar or event and accumulates from there. TradingView's VWAP indicator supports recurring anchor periods; a separately chosen historical start also needs an exact selection rule.[1]

Record four details before comparing two VWAP lines:

  • The first included bar: identify its timestamp, not just a nearby chart drawing.
  • The reset event: for example, a named session opening or a specified calendar boundary.
  • The included hours: regular and extended sessions can supply different observations.
  • The timezone: name the timezone used by the reset rule.

TradingView distinguishes session definitions from chart display settings. Pine time functions use their documented timezone rules; changing the chart's display timezone does not change the script's calculations.[6][7] A trading session can also span two calendar dates, so “reset each day” is incomplete unless “day” is defined.

An anchor selected retrospectively because it lines up with a later move introduces a separate selection problem. If the anchor is a confirmed swing, record when that swing became identifiable. The chart location of a pivot can precede its confirmation time.[8]

What does VWAP mean on forex and CFD feeds?

The word “volume” does not establish the data's units. MetaQuotes distinguishes forex tick volume, which counts price changes, from volumes of executed trades.[2] When a forex or CFD feed supplies tick volume, a bar with more reported updates receives more weight. Those counts are not a centralised record of the entire market's traded quantity.

TradingView explicitly states that forex providers differ in their data and volume availability.[3] Some symbols or resolutions have no volume data. Do not assume every forex or CFD symbol supplies tick volume, traded volume or a usable VWAP.

Available input Meaning for VWAP
Traded volume The calculation weights prices by reported traded quantity for that feed's coverage.
Tick volume The calculation weights prices by reported updates, not transaction sizes.
Missing volume The required weights are unavailable; a numeric replacement changes the calculation.

Two feeds can therefore disagree even with the same price-source formula and anchor. Differences may come from prices, update counts, available volume or included sessions. Confirm what the specific symbol supplies before interpreting “price above VWAP” as comparable across feeds.

How does ta.vwap handle the anchor in Pine Script?

As of 25 September 2026, Pine Script v6 provides the anchored form ta.vwap(source, anchor).[4] TradingView's release notes explain that the Boolean anchor resets the calculation when true; when false, accumulated values continue from the previous reset.[5]

The anchor is therefore a reset event, not a period length. Making it true on every bar repeatedly resets the totals. With valid positive volume, the resulting one-bar average equals that bar's selected price source.

If the source is typical price, that first-bar VWAP need not equal the close. A condition comparing close with VWAP is comparing two distinct values. A script also needs an explicit rule for unavailable values before an intended anchor or when usable volume is missing.

What is an exact VWAP crossing condition?

Illustrative condition, not a recommendation. Define an upward event on a closed chart bar when both VWAP observations are valid, the current bar does not reset the anchor, and:

Previous close ≤ previous VWAP AND current close > current VWAP

Excluding the reset bar in this illustration makes the comparison use one anchor interval. Including that bar would instead allow a crossing between averages built from different intervals. Neither interpretation is implied by “cross VWAP”; the rule must specify the choice.

A downward event reverses the inequalities. Remaining above VWAP is a state and may last for many bars without a new crossing. The same distinction matters for RSI crossing conditions and does not decide whether a broker position already exists.

Both price and volume update during a realtime bar, so the current VWAP can change before the bar closes.[9] Match the alert's evaluation and frequency to the chosen confirmation rule. TradingView requires a running alert created from the intended event, and saves its script, inputs, symbol and timeframe at creation.[10]

How does a VWAP event reach an MT5 broker account?

A true comparison is separate from the TradingView alert triggering. Webhook delivery is another stage, followed by PineConnector processing and the EA's order request. Broker acceptance, any resulting deal and the account position must then be verified separately.

The user supplies the requested command, exact broker symbol, size and any stops or targets using PineConnector Syntax.[11] VWAP does not choose those instructions. An exit condition referring to VWAP in a strategy also does not create a broker-side stop loss.

Follow PineConnector's demo verification procedure through the TradingView log, Portal → Bridge processing record and intended broker account.[12] MetaTrader 5 records orders, deals and positions as distinct objects.[13] A processing record alone cannot establish the resulting position.

PineConnector documents that TradingView and MetaTrader can use different feeds, quotes, spreads and timestamps.[14] A VWAP level from TradingView is therefore not proof that a broker will accept an order or stop at that exact price.

Which VWAP mistakes change the calculation?

  • Leaving the anchor implicit. Session, calendar-day and selected-event resets can include different bars.
  • Confusing tick volume with traded quantity. The units of the weights determine what the average describes.
  • Using missing volume as zero without explanation. Missing data and an observed zero are different; replacing missing values changes the observations included.
  • Assuming timeframe independence. Bar-based typical-price calculations can change when data is aggregated into different bar lengths.
  • Selecting an anchor with hindsight. A visually attractive historical starting point is not evidence it was identifiable when the rule would have acted.
  • Treating VWAP as a required destination. A weighted average imposes no obligation on later prices to return to it.

Frequently asked questions

What is the VWAP formula?

VWAP equals the sum of each included price multiplied by its volume, divided by the sum of those volumes. Both totals start at a defined anchor and reset together. A bar-based calculation often uses typical price, (high + low + close) ÷ 3. The result requires valid inputs and positive cumulative volume.

What is anchored VWAP?

Anchored VWAP accumulates price-times-volume and volume from a specified starting bar or event. The chosen anchor determines which observations belong in the average. Session VWAP uses recurring session boundaries, while a selected historical anchor can span multiple sessions. Record the anchor timestamp, reset rule, included hours and timezone before comparing implementations.

Can you use the VWAP indicator on forex?

A forex VWAP calculation depends on the selected feed's volume data. If the feed supplies tick volume, the average weights prices by reported updates rather than total currency-market traded quantity. Some symbols or timeframes have no volume data. Verify the feed, volume units, price source and anchor before interpreting or comparing forex VWAP values.

What does the anchor argument in ta.vwap do?

In Pine Script's anchored VWAP function, the Boolean anchor argument resets the accumulated calculation when true. When false, accumulation continues from the previous reset. Setting the anchor true on every bar therefore repeatedly restarts the calculation. With valid positive volume, each one-bar VWAP equals the selected source value, which need not be the close.

Reviewed 25 September 2026. Facts were checked against the linked sources on that date. Nothing in this article was tested on a trading account and no code was compiled.

Related reading

Sources

  1. TradingView – Volume Weighted Average Price (VWAP), accessed 25 September 2026.
  2. MetaQuotes – Volumes, accessed 25 September 2026.
  3. TradingView – What is the difference between ICE and other forex providers?, accessed 25 September 2026.
  4. TradingView – Pine Script v6 reference: ta.vwap, accessed 25 September 2026.
  5. TradingView – Pine Script release notes: VWAP anchor parameter, accessed 25 September 2026.
  6. TradingView – Sessions, accessed 25 September 2026.
  7. TradingView – Time, accessed 25 September 2026.
  8. TradingView – Repainting: plotting in the past, accessed 25 September 2026.
  9. TradingView – Execution model: realtime bars, accessed 25 September 2026.
  10. TradingView – Alerts, accessed 25 September 2026.
  11. PineConnector – PineConnector Syntax, accessed 25 September 2026.
  12. PineConnector – Test your setup, accessed 25 September 2026.
  13. MetaQuotes – Basic principles: orders, deals and positions, accessed 25 September 2026.
  14. PineConnector – Frequently asked questions: price differences, accessed 25 September 2026.

PineConnector executes the instructions you send it. It does not select trades, manage money, or hold funds. Trading carries risk, and past performance of any strategy does not indicate future results.


Leave a comment

Back To PiCo Blog

Ready when your strategy is

You bring the strategy.We bring the infrastructure.

Connect TradingView to MetaTrader, choose where MT5 runs and put the full PineConnector workflow through its paces from your first month.

Strategy and trading decisions remain yours. The MT5 environment can be ours.

PineConnector Edge

Run the full PineConnector workflow.

$59/mo at launch

Core plan · 1 connection · 1 hosted MT5 environment

Try Core for $7

7 days of Core for $7, then $59/month at the launch price unless you cancel.