Indicator · Pine Script v6 · On the chart

IPO Day Anchored VWAP

by major

IPO Day Anchored VWAP calculates a Volume Weighted Average Price anchored to the first available bar on a chart, representing an asset's initial public offering or historical debut.

View on GitHub

GitHub stars2on the repository
Pine versionv6current
Lines of code69
Settings4inputs
LicenceApache-2.0
Last update3 months ago29 Jul 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

69 lines of Pine Script v6 from ipo_vwap/ipo_vwap.pine, published under Apache-2.0. Keep the author's credit and licence lines when you reuse it.

ipo_vwap.pine
// Copyright 2026 Major Hayden
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//@version=6
indicator('IPO Day Anchored VWAP', shorttitle='IPO VWAP', overlay=true)

// === VWAP SETTINGS ===
grpVWAP = 'VWAP Settings'
vwapSource = input.source(hlc3, 'Source', group=grpVWAP, tooltip='Automatic IPO-day detection is reliable on Daily and higher timeframes only. On intraday charts, enable manual anchor date instead.')

// === MANUAL ANCHOR ===
grpManual = 'Manual Anchor'
useManualAnchor = input.bool(false, 'Use Manual Anchor Date', group=grpManual)
manualAnchorTime = input.time(timestamp('2020-01-01'), 'Anchor Date/Time', group=grpManual)

// === DISPLAY ===
grpDisplay = 'Display'
showIPOLabel = input.bool(true, 'Show IPO Label', group=grpDisplay)

// === ANCHOR LOGIC ===
// Auto mode: anchor on first bar (bar_index == 0)
autoAnchor = bar_index == 0

// Manual mode: latch on first bar where time >= manualAnchorTime
var bool manualAnchorFired = false
manualAnchor = false
if useManualAnchor and not manualAnchorFired and time >= manualAnchorTime
    manualAnchorFired := true
    manualAnchor := true

// Choose active anchor: manual overrides auto
activeAnchor = useManualAnchor ? manualAnchor : autoAnchor

// === VWAP CALCULATION ===
vwapValue = ta.vwap(vwapSource, activeAnchor)

// === PLOTTING ===
// Color/thickness are left as plot() literals so TradingView exposes them
// in the indicator's built-in "Style" tab instead of the "Inputs" tab.
plot(vwapValue, 'VWAP', color=color.aqua, linewidth=2)

// === ANCHOR LABEL ===
if showIPOLabel and activeAnchor
    labelText = useManualAnchor ? 'Anchor' : 'IPO'
    label.new(bar_index, low, labelText, style=label.style_label_up, color=color.red, textcolor=color.white, size=size.small)

// === RIGHT-EDGE LABEL ===
// Small label tracking the current end of the VWAP line, so it's easy to
// spot on busy charts. Created once, repositioned every bar while it's live.
var label vwapEdgeLabel = na
if showIPOLabel
    if na(vwapEdgeLabel)
        vwapEdgeLabel := label.new(bar_index, vwapValue, 'IPO', style=label.style_label_left, color=color.red, textcolor=color.white, size=size.small)
    if barstate.islast
        label.set_xy(vwapEdgeLabel, bar_index + 1, vwapValue)

// === ALERT ===
alertcondition(ta.cross(close, vwapValue), title='Price Crosses VWAP', message='{{ticker}}: Price crossed IPO VWAP')

Overview

IPO Day Anchored VWAP plots the anchored VWAP line on the main price chart alongside an anchor label and a tracking label at the chart's right edge. Users can override automatic anchor detection with a manual anchor date, which is ideal for intraday charts. Settings allow selecting the price source and toggling label visibility, with built-in alert conditions for price crosses.

Details

Published by

major on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Moving averages, Support & resistance, Volume

Markets

Stocks

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.

Settings

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

SettingTypeDefaultVariable
Sourcesourcehlc3vwapSource
Use Manual Anchor DateboolfalseuseManualAnchor
Anchor Date/Timetimetimestamp('2020-01-01')manualAnchorTime
Show IPO LabelbooltrueshowIPOLabel
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

Midnight VWAP

by TradersPost
218 stars

The Midnight VWAP indicator calculates and overlays two distinct Volume Weighted Average Price (VWAP) lines on the price chart based on customizable session timeframes. It tracks an overnight or pre-market session alongside regular trading hours, resetting cal

Indicator v6 Moving averagesSessions & time
Updated 3 months ago · None stated GitHub repository of Midnight VWAP
7 stars

This indicator overlays Bollinger Bands on the price chart and fills the area between upper and lower bands using a color based on Cumulative Volume Delta trend. It plots an EMA 9 line and fills between the EMA 9 and Bollinger basis in green or red depending o

Indicator v6 Volatility & bandsVolume
Updated 5 months ago · None stated GitHub repository of Deep Chart + BB (CVD Internal)

IFA-VP Context

by eddiebelaval
7 stars

This indicator plots a fixed lookback Volume Profile alongside 20, 50, and 200 Simple Moving Averages directly on the price chart. It highlights trend changes via moving average crosses and marks Point of Control reactions, High Volume Nodes, and Value Area bo

Indicator v6 VolumeSupport & resistance
Updated 3 months ago · None stated GitHub repository of IFA-VP Context

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