All posts

Strategies7 min read

How to Calculate Session VWAP From OHLCV Data

Build session VWAP from historical OHLCV bars in a spreadsheet, with cumulative formulas, a worked example, and data-quality checks.

By TerraTrade Team

Intraday candlestick chart and volume bars displayed on a trading screen

What this calculation produces#

Session VWAP is the cumulative volume-weighted average price for a chosen session. You can reproduce a common bar-based version from historical OHLCV data by assigning each bar a typical price, weighting it by that bar’s volume, and dividing the running price-volume total by running volume. TradingView and StockCharts describe this typical-price approach and its cumulative calculation. Volume Weighted Average Price (VWAP) — TradingView Volume-Weighted Average Price (VWAP) | ChartSchool | StockCharts.com

The key distinction is that this spreadsheet calculates VWAP from bars, not from every individual trade. A bar’s typical price is a representative input; it does not reveal the exact prices at which all volume inside that bar traded. SIX describes VWAP in terms of traded value divided by traded volume, which is a different level of input detail. Historical Prices Use the method below to consistently reproduce the specified OHLCV calculation—not to claim an exact trade-by-trade benchmark.

Spreadsheet columns and formulas#

In this layout, row 1 contains headers and row 2 is the first bar. Import Session, Time, High, Low, Close, and Volume in columns A–F. Enter the formulas below in row 2 and fill them down. The session-aware SUMIFS formulas total only rows through the current row that have the same session ID. That makes the cumulative totals restart for each new session without requiring a manual reset.

The formulas use ordinary spreadsheet functions available in current Excel and Google Sheets. Typical price is (High + Low + Close) / 3; price × volume is the typical price multiplied by the bar’s volume. Summing those products and dividing by summed volume yields the bar-based running VWAP. Volume Weighted Average Price (VWAP) — TradingView Volume-Weighted Average Price (VWAP) | ChartSchool | StockCharts.com

ColumnHeaderRow 2 content or formulaPurpose
ASessionImport session date or IDDefines where cumulative totals restart
BTimeImport bar timestampUse to verify chronological order
CHighImport bar highOHLC input
DLowImport bar lowOHLC input
ECloseImport bar closeOHLC input
FVolumeImport bar volumeWeight assigned to the bar
GTypical Price=(C2+D2+E2)/3Average of the bar’s high, low, and close
HPrice × Volume=G2*F2Bar typical price weighted by bar volume
ICumulative Price × Volume=SUMIFS($H$2:H2,$A$2:A2,A2)Running weighted-price total for this session
JCumulative Volume=SUMIFS($F$2:F2,$A$2:A2,A2)Running volume total for this session
KSession VWAP=IF(J2=0,"",I2/J2)Running weighted average; blank if volume is zero

The formula references expand through the current row, while the session criteria range also ends at the current row. That avoids including later bars in an earlier bar’s cumulative value.

  1. In G2, calculate a typical price for the bar: =(C2+D2+E2)/3.
  2. In H2, multiply that price by the bar volume: =G2*F2.
  3. In I2, calculate cumulative price × volume for the current session: =SUMIFS($H$2:H2,$A$2:A2,A2).
  4. In J2, calculate cumulative volume for the current session: =SUMIFS($F$2:F2,$A$2:A2,A2).
  5. In K2, divide the running weighted-price total by running volume: =IF(J2=0,"",I2/J2).
  6. Fill G2:K2 down the dataset. Keep full precision in the cells; apply display formatting only if you want to show fewer decimals.

Worked example: three bars, one session#

Suppose three bars belong to the same session. The example uses whole-number prices and illustrative volumes to make the arithmetic easy to check. The first bar’s VWAP equals its typical price when its volume is positive, because volume appears in both the price-volume numerator and the volume denominator. Volume-Weighted Average Price (VWAP) | ChartSchool | StockCharts.com

For bar 2, typical price is (13 + 11 + 12) / 3 = 12. Its weighted contribution is 12 × 200 = 2,400. The cumulative values through bar 2 are 3,400 and 300, so VWAP is 3,400 / 300 = 11.333… . For the final bar, the calculation is 4,500 / 400 = 11.25. The table displays VWAP to two decimals; the underlying division is not rounded.

BarHighLowCloseVolumeTypical pricePrice × volumeCumulative price × volumeCumulative volumeVWAP
11191010010.001,0001,00010010.00
213111220012.002,4003,40030011.33
312101110011.001,1004,50040011.25

Use this checklist to catch common spreadsheet errors before relying on the output.

  • Confirm the rows are sorted chronologically within each session, and that the session ID marks the reset you intended.
  • Check a row by hand: typical price should be between that bar’s low and high, and price × volume should equal typical price multiplied by volume.
  • Verify cumulative volume adds the current row’s volume to the previous running total for that session; verify the cumulative numerator adds the current price × volume.
  • For the first positive-volume bar in a session, VWAP should equal that bar’s typical price. Volume-Weighted Average Price (VWAP) | ChartSchool | StockCharts.com
  • If cumulative volume is zero, show a blank or another clearly defined missing-value marker rather than dividing by zero.
  • Decide whether extended-hours bars belong in the session before importing or filtering the data.

If you use VWAP in a strategy test#

VWAP is a calculation, not an entry signal. If you want to research a trading idea involving it, write down the rule separately from the formula and test it against historical data. For example, a test hypothesis might define a long setup as a bar closing above session VWAP after a prior close below it. Specify entry timing, invalidation, and exit rules before running the test; those choices are hypotheses to evaluate, not recommendations or evidence of an edge.

For any strategy-style research, separate the measurement from the trade rules. The following are test-design prompts, not a suggested setup.

  • Setup definition: state the market, bar interval, session hours, and exact VWAP formula. Define the example condition in machine-checkable terms, including what counts as a cross and whether the signal uses a bar close.
  • Entry hypothesis: choose a consistent executable timing rule, such as entering at the next bar’s open after a qualifying close. Include realistic fees, spread, and slippage assumptions where the data supports them.
  • Invalidation and exit hypothesis: write a specific stop or invalidation condition and a separate exit rule, such as a defined time exit. Do not change these rules after seeing individual outcomes.
  • Failure conditions: test or flag sessions with missing bars, unusual volume, gaps, different trading hours, or a data source whose volume definition is incompatible with the test. Bar-based VWAP may also differ from trade-level calculations.
  • Journal tags: record strategy version, session definition, bar interval, VWAP method, signal type, entry rule, exit rule, and data-quality issue. Keep tags consistent so results can be grouped and audited.
  • Reproducible backtest plan: preserve the source file and formula version; record the date range and filters; verify selected rows by hand; run the same fixed rules across the chosen sample; and report assumptions, excluded data, and limitations alongside results.

Frequently asked questions#

What is the formula for session VWAP from OHLCV bars?

For the typical-price bar method, calculate (High + Low + Close) / 3 for each bar, multiply by that bar’s volume, then divide cumulative price × volume by cumulative volume. Volume Weighted Average Price (VWAP) — TradingView Volume-Weighted Average Price (VWAP) | ChartSchool | StockCharts.com

Will this exactly match a trade-by-trade VWAP?

The spreadsheet above uses typical price as a representative price for each bar. It cannot recover the exact distribution of trades across prices inside that bar, so it may differ from trade-level VWAP. Historical Prices

How do I make cumulative VWAP reset each session?

Use a session identifier that matches your analysis and include only the bars assigned to that session. If extended-hours bars are present, decide explicitly whether they belong. The VWAP calculation resets at the selected anchor. Volume Weighted Average Price (VWAP) — TradingView

What should the sheet show when volume is zero?

Use a clear blank or missing-value marker when cumulative volume is zero; the formula in this guide returns a blank instead of dividing by zero. For a session’s first positive-volume bar, VWAP should equal its typical price. Volume-Weighted Average Price (VWAP) | ChartSchool | StockCharts.com

Why might my result differ from a charting platform?

Check the session labels and row order, then compare the cumulative price × volume and cumulative volume at selected rows. Different session boundaries or bar-based versus trade-level inputs can produce different values even when each calculation is internally consistent. Volume Weighted Average Price (VWAP) — TradingView Historical Prices

Once the calculation is checked, keep your assumptions and test rules documented.

A spreadsheet view showing columns for Session, Time, High, Low, Close, Volume, Typical Price, Price × Volume, cumulative totals, and VWAP calculated per session.
VWAP from OHLCV in a spreadsheet: typical price, price × volume, cumulative totals, and a per‑session reset.

Sources#

Your journal writes posts like this about you.

Connect a broker and TerraTrade turns your own trades into the findings that matter.