Indicator · Pine Script v6 · On the chart

VWAP Bands [trugurpala]

by trugurpala

This indicator plots a volume-weighted average price that restarts at the beginning of each daily session, using typical price and cumulative volume.

View on GitHub

GitHub stars4on the repository
Pine versionv6current
Lines of code38
Settings3inputs
LicenceMIT
Last update2 months ago3 Aug 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

38 lines of Pine Script v6 from examples/indicators/06_vwap_session.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

06_vwap_session.pine
//@version=6
// VWAP + Standard Deviation Bands — github.com/trugurpala/pinescriptv6
// Author: Ugur Pala · mail@ugurpala.com
indicator("VWAP Bands [trugurpala]", overlay=true)

// ── Inputs ───────────────────────────────────────────────────────────────────
bool  showBands = input.bool(true, "Show Bands")
float mult1     = input.float(1.0, "Band 1 Mult", step=0.1)
float mult2     = input.float(2.0, "Band 2 Mult", step=0.1)

// ── Calculations (cumulative from day start) ─────────────────────────────────
bool isNewDay = ta.change(time("D")) != 0
var float cumVol    = 0.0
var float cumVolPx  = 0.0
var float cumVolPx2 = 0.0

if isNewDay
    cumVol    := 0.0
    cumVolPx  := 0.0
    cumVolPx2 := 0.0

cumVol    += volume
cumVolPx  += volume * hlc3
cumVolPx2 += volume * hlc3 * hlc3

float vwapVal  = cumVolPx / cumVol
float variance = cumVolPx2 / cumVol - vwapVal * vwapVal
float stdev    = math.sqrt(math.max(variance, 0))

// ── Visuals ──────────────────────────────────────────────────────────────────
plot(vwapVal, "VWAP", color.new(color.orange, 0), linewidth=2)
p1u = plot(showBands ? vwapVal + mult1 * stdev : na, "Upper 1", color.new(color.blue, 50))
p1l = plot(showBands ? vwapVal - mult1 * stdev : na, "Lower 1", color.new(color.blue, 50))
p2u = plot(showBands ? vwapVal + mult2 * stdev : na, "Upper 2", color.new(color.purple, 50))
p2l = plot(showBands ? vwapVal - mult2 * stdev : na, "Lower 2", color.new(color.purple, 50))
fill(p1u, p1l, color.new(color.blue,   93))
fill(p2u, p1u, color.new(color.purple, 93))
fill(p1l, p2l, color.new(color.purple, 93))

Overview

VWAP Bands [trugurpala] draws the VWAP line on the price chart and optional standard-deviation bands at two user-set multipliers. Band visibility and both multipliers are the main settings. It does not generate trade signals or manage exits.

Details

Published by

trugurpala on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Volume, Volatility & bands, Sessions & time

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

aialgorithmic-tradingclaude-codecodexcoding-agentsgithub-copilotopen-sourcepine-scriptpine-script-v6technical-analysis

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Show BandsbooltrueshowBands
Band 1 Multfloat1.0mult1
Band 2 Multfloat2.0mult2
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

LoD Intraday Entry

by ChartsLector
41 stars

This overlay indicator marks the current day's low and a suggested entry zone a fraction of daily ATR below that low. It compares daily volume with a volume moving average, plots daily SMA and EMA distance, and draws an optional ATR-width price cloud. Labels c

Indicator v6 Support & resistanceVolatility & bands
Updated 2 days ago · None stated GitHub repository of LoD Intraday Entry
9 stars

Peak Trading Activity Graphs displays historical market activity across cyclical timeframes directly on the main chart using an on-screen dashboard table. It evaluates volume or volatility across selected periods, including hours of the day, days of the week,

Indicator v6 VolumeVolatility & bands
Updated 4 months ago · MIT GitHub repository of Peak Trading Activity Graphs [LuxAlgo]
6 stars

This overlay indicator maps an opening drive for a chosen session, using the first 30 or 60 minutes. It tracks drive high, low, midpoint, range, pace, and volume versus a multi-session average, then projects continuation lines from the drive edge and fade line

Indicator v6 Sessions & timeSupport & resistance
Updated 8 weeks ago · MIT GitHub repository of Capital41 Opening Drive Playbook

This indicator plots a Supertrend-based trend-following setup in a separate pane and skips conditions it treats as a sideways market. A volatility range is built from an ATR value, with RMA, SMA, EMA, or WMA smoothing, or from a fixed point distance. Optional

Indicator v5 TrendVolatility & bands
Updated 1 year ago · MPL-2.0 GitHub repository of Trend Following Setup - Sideways Market Skipper

VP

by dearvn
257 stars

This indicator calculates and plots a session-based volume profile directly on the price chart. It maps volume distribution across price levels, highlighting key structural reference points including the Point of Control, Value Area High, and Value Area Low. C

Indicator v5 VolumeSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of VP
219 stars

An educational Pine Script v4 indicator demonstrating how to plot volume histograms on the main price chart using unscaled axes. The code includes examples and commented templates for creating vertical line markers at specific dates or time zones, such as mark

Indicator v4 Sessions & timeVolume
Updated 5 years ago · None stated GitHub repository of 教學-畫垂直線1

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers