An overlay indicator that builds a volume profile over a set number of recent days and marks the volume point of control as a line, along with period high and low lines.
1Copy the scriptPress Copy script above, or the copy button on the code below.
2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.
Source Code
224 lines of Pine Script v6 from VP_Period_v4_Reference.pine, published under GPL-3.0. Keep the author's credit and licence lines when you reuse it.
VP_Period_v4_Reference.pine
//@version=6
study("VP-Period", overlay=true, max_bars_back = 1000, max_lines_count=500)
var bool is_first_candle= true
var diff = 0.0
float maxV = 0.0
int maxV_index = 0
int last_time = 0
margin=0.0
ys=0.0
int bar_offset=0
var is_first_inRange=false
period_time = input(defval = 10,
title = "Number of days (Min: 3, Max: 500)",
type = input.integer,
minval = 3,
maxval = 500)
resolution = input(defval = 500,
title = "calculation resolution (Min: 400, Max: 700)",
type = input.integer,
minval = 400,
maxval = 700)
show_from = input(defval = 3,
title = "show support/resistance since (Min: 2, Max: 45)",
type = input.integer,
minval = 2,
maxval = 45)
show_volume_bars = input(defval = true,
title = "Show volume bars (If selected, maximum days are 17)",
type = input.bool
)
show_vpoc_line = input(defval = true,
title = "Show VPOC line",
type = input.bool
)
show_support_line = input(defval = true,
title = "Show support line",
type = input.bool
)
show_res_line = input(defval = true,
title = "Show resistance line",
type = input.bool
)
show_H_line = input(defval = true,
title = "Show high line",
type = input.bool
)
show_L_line = input(defval = true,
title = "Show low line",
type = input.bool
)
show_labels = input(defval = true,
title = "Show from days label",
type = input.bool
)
vpoc_color = input(defval = color.new(color.yellow, 10),
title = "VPOC color",
type = input.color
)
high_low_color = input(defval = color.new(color.blue, 50),
title = "High-low lines color",
type = input.color
)
volume_bars_color = input(defval = color.new(color.green, 70),
title = "Volume bars color",
type = input.color
)
sup_color = input(defval = color.new(color.red, 10),
title = "Support line color",
type = input.color
)
res_color = input(defval = color.new(color.green, 10),
title = "Resistance line color",
type = input.color
)
range_prices = array.new_float((resolution + 1), 0.0)
partial_vol = array.new_float(resolution, 0.0)
total_vol = array.new_float(resolution, 0.0)
var all_ys = array.new_float(show_from, 0.0)
var ys_time = array.new_float(show_from, 0.0)
var is_support = array.new_bool(show_from, true)
t = time("1440", session.regular)
var int startTime =time
int ncandles =0
if barstate.isfirst
startTime := timenow - period_time*86400000
bar_offset:= barssince(is_first_inRange)
is_first = na(t[1]) and not na(t) or t[1] < t
is_first_inRange:=is_first and t>startTime
high_price=0.0
low_price=0.0
price_level=0.0
if is_first_inRange or barstate.islast
last_time:= t[1]
ncandles := bar_offset
current_low_price=0.0
for i = 1 to (ncandles)
current_low_price:=low[i]
if current_low_price < low_price or low_price==0.0
low_price:=current_low_price
current_high_price=0.0
for i = 1 to (ncandles)
current_high_price:=high[i]
if current_high_price >high_price or high_price==0.0
high_price:=current_high_price
diff := (high_price-low_price)/resolution
for j = 0 to (resolution)
array.set(range_prices, (j), (low_price + (diff * (j+1))))
for i = 0 to (ncandles)
int w_candle = 0
array.fill(partial_vol, 0.0)
for j=0 to (resolution-1)
float current_price = array.get(range_prices, j)
if high[i] > current_price and low[i] < current_price
float j_partial_vol = array.get(partial_vol, j)
float sum_vol = j_partial_vol + nz(volume[i])
array.set(partial_vol, j, sum_vol)
w_candle := w_candle + 1
for j = 0 to (resolution - 1)
float j_total_vol = array.get(total_vol, j)
float j_partial_vol = array.get(partial_vol, j)
float sum_partial_total=0.0
if w_candle > 0
sum_partial_total := j_total_vol + j_partial_vol/w_candle
else
sum_partial_total := j_total_vol
array.set(total_vol, j, sum_partial_total)
maxV := array.max(total_vol)
maxV_index := array.indexof(total_vol, maxV)
if is_first_inRange
price_level:=diff*maxV_index+low_price
if high_price - price_level > price_level - low_price
margin:=high_price - price_level
ys:=price_level - margin
else
margin:=price_level - low_price
ys:=price_level + margin
if ys > high_price
array.shift(is_support)
array.push(is_support, false)
else
array.shift(is_support)
array.push(is_support, true)
array.shift(all_ys)
array.push(all_ys, ys)
array.shift(ys_time)
array.push(ys_time, t)
if barstate.islast
for i=0 to (show_from - 1)
ys := array.get(all_ys, i)
time_back = array.get(ys_time, i)
if array.get(is_support, i)
if show_support_line
line.new(x1=int(time_back), y1=ys, x2=time + 86400000, y2=ys, color=sup_color ,xloc= xloc.bar_time, extend = extend.none, width=2, style=line.style_dashed)
else
if show_res_line
line.new(x1=int(time_back), y1=ys, x2=time + 86400000, y2=ys, color=res_color ,xloc= xloc.bar_time, extend = extend.none, width=2, style=line.style_dashed)
if show_labels
label.new(int(time + 86400000), ys, text ="From days: " + tostring(show_from - i), xloc=xloc.bar_time)
dif_time=0.0
if is_first_inRange or barstate.islast
last_time:= int(t[1])
dif_time:= (time-last_time)
if dif_time/86400000 > 1.5
dif_time:=(dif_time)/9
else
dif_time:=(dif_time)/3
diff_t=0
x1=0.0
norm_vol=0.0
proportion=resolution/40
for i = 0 to (resolution - 1)
y=array.get(range_prices,i)
current_vol= array.get(total_vol,i)
norm_vol :=current_vol/maxV
x1 :=dif_time*norm_vol
diff_t := last_time + int(x1)
if (i % int(proportion) == 0 or int(proportion) == 0) and show_volume_bars
line.new(x1=t[1], y1=y, x2=diff_t, y2=y, color=volume_bars_color ,xloc= xloc.bar_time, extend = extend.none, width=2)
if show_L_line
line.new(x1=t[1], y1=low_price, x2=time, y2=low_price,xloc= xloc.bar_time, color=high_low_color)
if show_vpoc_line
line.new(x1=t[1], y1=diff*maxV_index+low_price, x2=time, y2=diff*maxV_index+low_price, color=vpoc_color, width=2,xloc= xloc.bar_time)
if show_H_line
line.new(x1=t[1], y1=high_price, x2=time, y2=high_price,xloc= xloc.bar_time, color=high_low_color)
Overview
VP-Period also draws support and resistance lines derived from profiles looking back a chosen number of days, with labels for each. Optional volume bars can be shown, though the days limit drops to 17 when they are on. Calculation resolution, colours and which lines appear are adjustable. It is written in older Pine syntax and gives no trade signals.
The inputs you can change from the gear icon on the chart. Defaults are the author's.
Setting
Type
Default
Variable
Number of days (Min: 3, Max: 500)
int
10
period_time
calculation resolution (Min: 400, Max: 700)
int
500
resolution
show support/resistance since (Min: 2, Max: 45)
int
3
show_from
Show volume bars (If selected, maximum days are 17)
bool
true
show_volume_bars
Show VPOC line
bool
true
show_vpoc_line
Show support line
bool
true
show_support_line
Show resistance line
bool
true
show_res_line
Show high line
bool
true
show_H_line
Show low line
bool
true
show_L_line
Show from days label
bool
true
show_labels
VPOC color
color
color.new(color.yellow, 10)
vpoc_color
High-low lines color
color
color.new(color.blue, 50)
high_low_color
Show all 15 settings
Setting
Type
Default
Variable
Volume bars color
color
color.new(color.green, 70)
volume_bars_color
Support line color
color
color.new(color.red, 10)
sup_color
Resistance line color
color
color.new(color.green, 10)
res_color
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.
This overlay indicator draws a fixed-range volume profile on the price chart, splitting traded activity into up and down volume at each price level. It also plots a sentiment profile, a developing point of control, and value-area high and low around a configur
The MGIC-tracker is a TradingView indicator that overlays ARK Invest trade records onto stock price charts. It plots buy and sell labels at the exact timestamp of each transaction, showing share volume and ETF weight. Users select a specific ETF type via setti
This overlay indicator marks call and put setups from EMAs, RSI, MACD, and a SPY volume ratio. A call needs higher highs, RSI above its minimum, rising MACD, above-average proxy volume, and a rising trend EMA; a put reverses those tests. Early markers use an E
Comprehensive Volume Profile is an overlay indicator that calculates and plots volume distribution across specified time ranges such as daily sessions, weekly, monthly, or custom bar lengths. It identifies key structural price levels including the Point of Con
This indicator plots two Hull moving averages on the price chart, one of the selected price and one of close, and optionally smooths both with a Kahlman filter. It fills the space between them and marks buy and sell labels when they cross, provided scaled volu
This overlay indicator plots option strike walls and an optional session VWAP on the price chart for SPY or ES. It spaces major strikes by the selected instrument, draws a set number of strikes on each side, and marks wall-trap and sweep events after a cooldow