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

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
| Column | Header | Row 2 content or formula | Purpose |
|---|---|---|---|
| A | Session | Import session date or ID | Defines where cumulative totals restart |
| B | Time | Import bar timestamp | Use to verify chronological order |
| C | High | Import bar high | OHLC input |
| D | Low | Import bar low | OHLC input |
| E | Close | Import bar close | OHLC input |
| F | Volume | Import bar volume | Weight assigned to the bar |
| G | Typical Price | =(C2+D2+E2)/3 | Average of the bar’s high, low, and close |
| H | Price × Volume | =G2*F2 | Bar typical price weighted by bar volume |
| I | Cumulative Price × Volume | =SUMIFS($H$2:H2,$A$2:A2,A2) | Running weighted-price total for this session |
| J | Cumulative Volume | =SUMIFS($F$2:F2,$A$2:A2,A2) | Running volume total for this session |
| K | Session 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.
- In G2, calculate a typical price for the bar: =(C2+D2+E2)/3.
- In H2, multiply that price by the bar volume: =G2*F2.
- In I2, calculate cumulative price × volume for the current session: =SUMIFS($H$2:H2,$A$2:A2,A2).
- In J2, calculate cumulative volume for the current session: =SUMIFS($F$2:F2,$A$2:A2,A2).
- In K2, divide the running weighted-price total by running volume: =IF(J2=0,"",I2/J2).
- 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.
| Bar | High | Low | Close | Volume | Typical price | Price × volume | Cumulative price × volume | Cumulative volume | VWAP |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 11 | 9 | 10 | 100 | 10.00 | 1,000 | 1,000 | 100 | 10.00 |
| 2 | 13 | 11 | 12 | 200 | 12.00 | 2,400 | 3,400 | 300 | 11.33 |
| 3 | 12 | 10 | 11 | 100 | 11.00 | 1,100 | 4,500 | 400 | 11.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.

Sources#
- Volume Weighted Average Price (VWAP) — TradingView — tradingview.com
- Volume-Weighted Average Price (VWAP) | ChartSchool | StockCharts.com — chartschool.stockcharts.com
- Historical Prices — six-group.com
- https://www.investing.com/academy/analysis/vwap-formula/ — investing.com
- https://www.marketvolume.com/technicalanalysis/vwap.asp — marketvolume.com
- https://www.everfunded.com/tools/vwap-calculator — everfunded.com
- https://ta-lib.org/functions/vwap.html — ta-lib.org
- https://questdb.com/docs/cookbook/sql/finance/vwap/ — questdb.com
- https://en.wikipedia.org/wiki/Volume-weighted_average_price — en.wikipedia.org
- https://ohlc.io/learn/what-is-ohlc-data — ohlc.io
- https://taughttotrade.com/vwap — taughttotrade.com
- https://www.quantnugget.com/learn/vwap — quantnugget.com
- https://tickerlayer.com/learn/vwap — tickerlayer.com
- https://owlgrouptrading.com/code/vwap — owlgrouptrading.com
- https://en.wikipedia.org/wiki/Typical_price — en.wikipedia.org
- https://www.ualberta.ca/en/finance-department/events/matt-taylor-presentation.pdf — ualberta.ca
KEEP READING

Strategies8 min read
How to Test a Time Stop for Intraday Trades
Test an intraday time stop against unchanged price exits with a practical worksheet for net P&L, MAE, MFE, and execution costs.
Read post
Product5 min read
Agentic Backtesting: Prove Your Setup Before You Risk a Dollar
TerraTrade's backtesting now has an AI agent beside your chart. It marks the levels, checks your entry, and shows what your setup would have made.
Read post
Backtesting11 min read
Walk‑forward testing in plain English
A practical guide to walk forward analysis trading: rolling fit/test windows, parameter stability, and decision rules that avoid leakage.
Read post