Indicator · Pine Script v6 · On the chart

Premarket Metrics Dashboard

by realanthonyc

This indicator calculates and displays key premarket metrics in a table dashboard located on the top right of the price chart.

View on GitHub

GitHub stars2on the repository
Pine versionv6current
Lines of code135
Settings0inputs
LicenceMPL-2.0
Last update7 months ago6 Mar 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

135 lines of Pine Script v6 from premarket.pine, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

premarket.pine
// This Pine Script® code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © realanthonyc https://www.tradingview.com/u/realanthonyc

//@version=6
// ----------------------------------------------------------------------
//  Premarket Metrics Dashboard
//  On GitHub: https://github.com/realanthonyc/Premarket-Metrics-Dashboard
//  v1.0.0
// ----------------------------------------------------------------------
indicator(title="Premarket Metrics Dashboard", shorttitle="Pre", overlay=true)

// Function to get yesterday's regular close
yesterdayClose() => request.security(syminfo.tickerid, "D", close[1], lookahead=barmerge.lookahead_on)

// Variables for premarket calculations
var float pmHigh = na
var float pmLow = na
var float pmVwapCumPriceVol = 0.0
var float pmVwapCumVol = 0.0
var float pmVwap = na

// Reset at the start of each premarket session (first bar of extended session)
if session.isfirstbar
    pmHigh := high
    pmLow := low
    pmVwapCumPriceVol := 0.0
    pmVwapCumVol := 0.0
else if session.ispremarket
    pmHigh := math.max(pmHigh, high)
    pmLow := math.min(pmLow, low)
    typicalPrice = (high + low + close) / 3
    pmVwapCumPriceVol += typicalPrice * volume
    pmVwapCumVol += volume

// Calculate premarket VWAP if sufficient volume
if pmVwapCumVol > 0
    if pmVwapCumVol >= 1000
        pmVwap := pmVwapCumPriceVol / pmVwapCumVol
    else
        pmVwap := na

// Current price
currentPrice = close

// Gap % vs yesterday close
yestClose = yesterdayClose()
gapPct = (currentPrice - yestClose) / yestClose * 100

// NQ Futures change % (daily)
nqClose = request.security("CME_MINI:NQ1!", "D", close)
nqPrevClose = request.security("CME_MINI:NQ1!", "D", close[1])
nqChangePct = (nqClose - nqPrevClose) / nqPrevClose * 100

// Overnight Trend
string overnightTrend = na
if currentPrice > yestClose
    overnightTrend := "Bullish"
else if currentPrice < yestClose
    overnightTrend := "Bearish"
else
    overnightTrend := "Neutral"

// Overnight Range (premarket high - low)
overnightRange = pmHigh - pmLow

// Historical Volatility as proxy for IV (from daily data)
hv30d = request.security(syminfo.tickerid, "D", ta.stdev(math.log(close / close[1]), 30) * math.sqrt(252) * 100)
hv5d  = request.security(syminfo.tickerid, "D", ta.stdev(math.log(close / close[1]), 5)  * math.sqrt(252) * 100)

// Create dashboard table with 11 rows (header + 10 metrics)
var table dashTable = table.new(
     position.top_right, 
     columns=2, 
     rows=11, 
     border_width=1, 
     frame_width=2, 
     bgcolor=color.white
     )

// Function to format float with 2 decimals, handle na
fmtFloat(float val) => na(val) ? "N/A" : str.tostring(val, "#.##")

// Update table only on last bar
if barstate.islast
    // Headers (row 0)
    table.cell(dashTable, 0, 0, "Metric", text_halign=text.align_left, text_formatting=text.format_bold, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 0, "Value", text_halign=text.align_left, text_formatting=text.format_bold, bgcolor=color.white, text_size=size.small)
    
    // 1. Current Price (row 1)
    table.cell(dashTable, 0, 1, "Current Price", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 1, fmtFloat(currentPrice), text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    
    // 2. Gap % vs Yest Close (row 2)
    color gapColor = gapPct > 0 ? color.green : gapPct < 0 ? color.red : color.gray
    table.cell(dashTable, 0, 2, "Gap % vs Yest Close", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 2, fmtFloat(gapPct) + "%", text_halign=text.align_left, text_color=gapColor, bgcolor=color.white, text_size=size.small)
    
    // 3. NQ Futures Change % (row 3)
    color nqColor = nqChangePct > 0 ? color.green : nqChangePct < 0 ? color.red : color.gray
    table.cell(dashTable, 0, 3, "NQ Futures Change %", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 3, fmtFloat(nqChangePct) + "%", text_halign=text.align_left, text_color=nqColor, bgcolor=color.white, text_size=size.small)
    
    // 4. Hist Vol (30d ann) (row 4)
    table.cell(dashTable, 0, 4, "Hist Vol (30d ann)", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 4, fmtFloat(hv30d) + "%", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    
    // 5. Hist Vol (5d ann) (row 5)
    table.cell(dashTable, 0, 5, "Hist Vol (5d ann)", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 5, fmtFloat(hv5d) + "%", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    
    // 6. Premarket High (row 6)
    table.cell(dashTable, 0, 6, "Premarket High", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 6, fmtFloat(pmHigh), text_halign=text.align_left, text_color=color.green, bgcolor=color.white, text_size=size.small)
    
    // 7. Premarket Low (row 7)
    table.cell(dashTable, 0, 7, "Premarket Low", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 7, fmtFloat(pmLow), text_halign=text.align_left, text_color=color.red, bgcolor=color.white, text_size=size.small)
    
    // 8. Premarket VWAP (row 8)
    string vwapDisplay = na(pmVwap) and pmVwapCumVol > 0 and pmVwapCumVol < 1000 ? "N/A (Low Vol)" : fmtFloat(pmVwap)
    table.cell(dashTable, 0, 8, "Premarket VWAP", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 8, vwapDisplay, text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    
    // 9. Overnight Range (row 9)
    table.cell(dashTable, 0, 9, "Overnight Range", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 9, fmtFloat(overnightRange), text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    
    // 10. Overnight Trend (row 10)
    string trendDisplay = na(overnightTrend) ? "N/A" : overnightTrend
    color trendColor = trendDisplay == "Bullish" ? color.green : trendDisplay == "Bearish" ? color.red : color.gray
    table.cell(dashTable, 0, 10, "Overnight Trend", text_halign=text.align_left, bgcolor=color.white, text_size=size.small)
    table.cell(dashTable, 1, 10, trendDisplay, text_halign=text.align_left, text_color=trendColor, bgcolor=color.white, text_size=size.small)

// Plot nothing on chart
plot(na)

Overview

Premarket Metrics Dashboard tracks the current price, gap percentage relative to the prior day close, overnight trend bias, premarket high and low, overnight range, premarket VWAP, and NQ Futures daily change. It also computes 5-day and 30-day historical volatility as proxies for implied volatility. The dashboard updates dynamically on the latest bar.

Details

Published by

realanthonyc on GitHub

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

Screeners & dashboards, Sessions & time, Volatility & bands

Markets

Stocks, Indices

Timeframes

M1-M5, M15-H1

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

indicatorpinescripttradingview

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

92 stars

This indicator classifies the market into gamma regime types (negative gamma trend, positive gamma mean-reversion, or transition) by calculating a composite score based on daily ATR ratios, session VWAP crossover frequencies, and opening range displacement. It

Indicator v5 Volatility & bandsTrend
Updated 8 weeks ago · Custom licence GitHub repository of Moon Dev GEX Regime & Trap
56 stars

This indicator marks forex trading sessions and opening ranges on the price chart. It can draw Sydney, Tokyo, Frankfurt, London, and New York session boxes or five- and fifteen-minute opening ranges, plus an optional opening channel and a day-open range. Day r

Indicator v5 Sessions & timeSupport & resistance Repaints
Updated 2 months ago · None stated GitHub repository of Day Trading Booster by DGT

AM TBR — NQ Stats

by TamaraKGreen
46 stars

The AM TBR indicator calculates statistical levels for NQ futures using standard deviation. It plots a sigma ladder showing touch levels at 0.5 to 2.0 standard deviations, marks touch points, displays Mean Absolute Error (MAE) zones after touches, and shows Me

Indicator v6 Volatility & bandsSupport & resistance
Updated 7 weeks ago · None stated GitHub repository of AM TBR — NQ Stats

Zen Trading Toolkit

by Zen-Tim
29 stars

This indicator plots average bar range (ABR) measured move targets, opening range boxes, and historical key reference levels directly on the price chart. It projects bullish and bearish targets (0.5x, 1.0x, 1.5x, 2.0x ABR) from the previous session's close, al

Indicator v6 Support & resistanceVolatility & bands
Updated 2 weeks ago · MIT GitHub repository of Zen Trading Toolkit
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]

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