Examples
Session volume profile
A volume profile of the current session, built bar by bar from footprints, drawn as horizontal bars on the last bar with its point of control and value area.
indicator "Session profile" { overlay: true }
widthBars = input.int("Width (bars)", 30, min: 5)
vaPct = input.float("Value area (%)", 70, min: 10, max: 100)
col = input.color("Color", #2962ff60)
var prof = footprint.accumulator()
if session.is_new { prof.reset() }
prof.add(bar.footprint)
if bar.last and prof.available {
biggest = 0
for lv in prof.levels { biggest = max(biggest, lv.volume) }
for lv in prof.levels {
hbar(lv.price, lv.volume, biggest, side: left, width: widthBars, color: col)
}
}
va = prof.value_area(vaPct)
plot(prof.poc, #e8c15a, title: "POC", style: "step")
plot(na(va) ? na : va.high, #2962ff, title: "VA high", style: "dotted")
plot(na(va) ? na : va.low, #2962ff, title: "VA low", style: "dotted")What to notice:
footprint.accumulator()sums footprints; it has the same fields and methods as one footprint (levels,poc,value_area…);hbar(price, value, max, width:)draws a bar whose length isvalue / maxofwidthbars;- footprints are only loaded because the script contains the word
footprint.