Indicator · Pine Script v6 · Own pane

Volume by Time [LuxAlgo]

by theonetrade· code credited to LuxAlgo

Volume by Time [LuxAlgo] evaluates volume patterns across specific intraday time slots by tracking volume at each hour, minute, and second across historical days.

View on GitHub

GitHub stars1on the repository
Pine versionv6current
Lines of code67
Settings7inputs
LicenceMIT
Last update2 weeks ago7 Nov 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

67 lines of Pine Script v6 from assets/volume-by-time-luxalgo-intraday-volume-profile-with-historical-average.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

volume-by-time-luxalgo-intraday-volume-profile-with-historical-average.pine
// This work is licensed under a Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) https://creativecommons.org/licenses/by-nc-sa/4.0/
// © LuxAlgo

//@version=6
indicator("Volume by Time [LuxAlgo]", "LuxAlgo - Volume by Time", format = format.volume)

//---------------------------------------------------------------------------------------------------------------------}
//User Inputs
//---------------------------------------------------------------------------------------------------------------------{
avgType = input.string("Average", title = "Analysis Type", options = ["Average","Median"])
sz = input.int(0, title = "Length (Days)", tooltip = "Averaging Length\nSet Value to 0 for Max Analysis Length")
bidi = input.bool(false, title = "Bi-Directional", tooltip = "Enable Bi-Directional Display\nBearish Volume will be negative, Bullish Volume will be positive.")
upCol = input.color(#089981, title = "Bullish Color", group = "Style")
downCol = input.color(#f23645, title = "Bearish Color", group = "Style")
upVolCol = input.color(color.new(color.gray,60), title = "Up Volume Color", group = "Style")
downVolCol = input.color(color.new(color.black,60), title = "Down Volume Color", group = "Style")
invis = color.rgb(0,0,0,100)

//---------------------------------------------------------------------------------------------------------------------}
//UDTs
//---------------------------------------------------------------------------------------------------------------------{

type vols
    array<float> ary

//---------------------------------------------------------------------------------------------------------------------}
//Variables
//---------------------------------------------------------------------------------------------------------------------{

var data = map.new<int,vols>()

vol = volume
v = close > open  ? vol : -vol

hms = hour*10000 + minute*100 + second

//---------------------------------------------------------------------------------------------------------------------}
//Calculations
//---------------------------------------------------------------------------------------------------------------------{

if na(data.get(hms))
    data.put(hms,vols.new(array.from(float(vol))))
else
    if sz != 0 and data.get(hms).ary.size() == sz
        data.get(hms).ary.shift()
    data.get(hms).ary.push(v)

raw_avg = avgType == "Average" ? data.get(hms).ary.avg() : data.get(hms).ary.median()
avg = avgType == "Average" ? data.get(hms).ary.abs().avg() :  data.get(hms).ary.abs().median()

avg_col = raw_avg > 0 ? upCol : downCol
vol_col = close > open ? upVolCol : downVolCol
dir_avg = raw_avg > 0 ? avg : -avg

//---------------------------------------------------------------------------------------------------------------------}
//Display
//---------------------------------------------------------------------------------------------------------------------{

plotcandle(0,bidi?dir_avg:avg,0,bidi?dir_avg:avg, bordercolor = avg_col, color = invis, wickcolor = invis, title = "Average Volume", display = display.pane, editable = false)
plotcandle(0,bidi?v:vol,0,bidi?v:vol, bordercolor = vol_col, color = vol_col, wickcolor = invis, title = "Volume", display = display.pane, editable = false)

plot(vol, style = plot.style_columns, color = vol_col, title = "Volume", display = display.status_line, editable = false)
plot(avg, style = plot.style_columns, color = avg_col, title = "Average Volume", display = display.status_line, editable = false)

plot(data.get(hms).ary.size(), display = display.status_line, color = chart.fg_color, format = format.volume, title = "Avg Length Readout")

//---------------------------------------------------------------------------------------------------------------------}

Overview

Volume by Time [LuxAlgo] calculates either the mean or median historical volume for each recurring time of day over a user-defined day length. An optional bi-directional setting highlights bullish versus bearish volume directional bias. The indicator plots current bar volume alongside historical average volume in a separate pane, helping traders identify recurring high-activity windows throughout the trading session.

Details

Published by

theonetrade on GitHub

Code credit

LuxAlgo, as written in the script's header

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

M15-H1, M1-M5

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

algorithmic-tradingbacktestingccxtcryptofair-value-gapheikin-ashiohlcvorder-flowpine-scriptpinescriptpynecorepythonquantitative-financesupertrendtechnical-analysistrading-indicatorstradingviewtradingview-indicatorsvolume-profile

Settings

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

SettingTypeDefaultVariable
Analysis TypestringAverageavgType
Length (Days)int0sz
Bi-Directionalboolfalsebidi
Bullish Colorcolor#089981upCol
Bearish Colorcolor#f23645downCol
Up Volume Colorcolorcolor.new(color.gray,60)upVolCol
Down Volume Colorcolorcolor.new(color.black,60)downVolCol
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

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
550 stars

Range Volume Change compares volume inside a chosen session window with the same window on the previous day and plots that change as a percentage. It accumulates volume during the window and, when enabled, volume outside it, drawing growing columns in a separa

Indicator v5 VolumeSessions & time Repaints
Updated 11 months ago · None stated GitHub repository of Range Volume Change

Session Pulse v2

by Matswm86
29 stars

Session Pulse v2 is a separate-pane intraday indicator designed for futures trading. It compares real-time volume, price range, and efficiency against multi-session historical medians for the exact same clock minute. The indicator classifies market conditions

Indicator v6 VolumeVolatility & bands
Updated 6 weeks ago · MIT GitHub repository of Session Pulse v2

Nexural Flow Pro

by JasonTeixeira
11 stars

Nexural Flow Pro plots real order flow data in a separate pane as stacked buy and sell volume columns. It highlights imbalances at 3:1 ratios with glow effects, detects absorption patterns, and marks unfinished auction continuations. Session filtering optional

Indicator v6 VolumeSessions & time
Updated 5 weeks ago · Custom licence GitHub repository of Nexural Flow Pro
10 stars

Meridian Options Context plots a separate-pane directional context for liquid options underlyings. It normalizes trend from fast and slow EMAs, RTH VWAP and opening-range displacement, RSI and short-return momentum, relative volume participation, persistence,

Indicator v6 Oscillators & momentumMoving averages Repaints
Updated 2 months ago · MPL-2.0 GitHub repository of Meridian - Options Context

Session Volume Averages

by eddiebelaval
7 stars

This indicator plots trading volume bars in a separate pane alongside historical volume benchmarks for up to three user-defined trading sessions. For each active session, it calculates two benchmarks over a selectable sample size of past sessions: an overall s

Indicator v6 VolumeSessions & time
Updated 4 months ago · None stated GitHub repository of Session Volume Averages

More Volume scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

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

Compare brokers