Volume indicator
VWAP Calculator
Compute the Volume Weighted Average Price from the cumulative price-times-volume and the cumulative volume for the session. Understanding what VWAP represents, the average price weighted by activity, is the point.
What VWAP is
The Volume Weighted Average Price is the average price of an instrument over a period, weighted by how much volume traded at each price. Unlike a plain moving average, it treats a bar that traded heavy volume as more important than a quiet one, so it reflects where the bulk of activity actually occurred.
For each bar you take the typical price, the average of the high, low, and close, and multiply it by that bar's volume. Keep a running total of those price-times-volume products and a running total of volume; VWAP at any point is the cumulative price-volume total divided by the cumulative volume. Because it is cumulative, VWAP is anchored to a starting point, and on live charts it typically resets at the start of each trading session, representing the volume-weighted average for the day so far.
Why VWAP is used
VWAP is widely followed by intraday traders and institutions as a benchmark for the average price paid during a session. Execution desks use it to judge whether they filled better or worse than the day's volume-weighted average, and many traders watch how price behaves around the VWAP line.
Whether price sits above or below VWAP, and what that means to you, is a matter of your own approach. It is a reference level, not a directive.
What are TradingView and Pine Script?
TradingView is one of the most widely used charting and market-analysis platforms, where traders and analysts study price movement across stocks, crypto, forex, and futures on interactive charts. Pine Script is TradingView's own lightweight programming language, created so anyone can build custom tools that run directly on those charts.
People use Pine Script to build four main kinds of tools. Indicators calculate and plot values on the chart, exactly like the calculation above, but recomputed automatically on every bar. Strategies add explicit entry and exit rules and can be backtested against historical data in TradingView's Strategy Tester to see how they would have behaved. Screeners scan many symbols at once for conditions you define. Alerts notify you the moment a condition you specified occurs, so you do not have to watch the screen.
The value is precision and automation. Instead of eyeballing a chart, you describe exactly what you want measured, visualized, or notified about, and TradingView runs it consistently across any market and timeframe. That is why traders, analysts, and developers write Pine Script: it turns a manual charting idea into a repeatable tool. These tools are for tracking, visualizing, and testing market ideas; they do not tell you what to trade, and that decision always remains yours.
Writing that code by hand means learning Pine Script's syntax, its type system, and the exact names of hundreds of built-in functions. It is a real programming language, and small mistakes stop a script from compiling in the Pine Editor.
Turn this into Pine Script
Here you computed VWAP from running totals. On a TradingView chart, VWAP updates every bar and usually resets each session automatically. Pine Script gives you the session-anchored version with ta.vwap(hlc3), but anchored VWAPs, bands, and multi-session logic take more code.
//@version=6
indicator("VWAP", overlay=true)
vwapValue = ta.vwap(hlc3)
plot(vwapValue, "VWAP", color=color.blue, linewidth=2)PineScripter is an AI built specifically for Pine Script. You describe what you want in plain English and it writes TradingView-ready v5 or v6 code. Because it is specialized on the Pine Script language and its exact function signatures, it tends to produce code that compiles far more reliably than general-purpose models like ChatGPT, which often invent functions that do not exist in Pine Script.
Related free calculators
From the blog
PineScripter is an AI developer tool that helps you write Pine Script code. It is not a financial advisor and will never offer financial, investment, or trading advice. Everything on this page, including the calculator and the explanations, is provided purely for educational and informational purposes. Any decision about how to interpret an indicator or trade a market is entirely your own. See our full disclaimer for more.