Custom volume profile look
A volume profile with a look of its own: each New York cash session folded on the right of its bars with delta coloured rows, a white point of control and a blue value area, the session open row marked on the developing profile, and the newest candle's ladder drawn on the price axis edge in a red to green gradient by delta.
//@xfscript 1
indicator("Profile Look")
let window: string = "0930-1600"
let width: float = input.float(30, "width", "Profile width percent", 5, 100, 5)
let ladder_px: float = input.float(160, "ladderWidth", "Live ladder width in pixels", 40, 600, 10)
let sell_color: color = input.color("#EF4444", "sellColor", "Sellers")
let buy_color: color = input.color("#22C55E", "buyColor", "Buyers")
let poc_color: color = input.color("#FFFFFF", "pocColor", "Point of control")
let va_color: color = input.color("#3B82F6", "vaColor", "Value area")
let in_session: bool = session.in(window, "America/New_York")
let was_in: bool = bar_index > 0 && in_session[1]
let first_bar: bool = in_session && !was_in
let session_end: bool = was_in && !in_session
var elapsed: float = 0
elapsed := first_bar ? 1 : in_session ? elapsed + 1 : elapsed
let folded: int = math.round(math.clamp(elapsed, 1, 5000))
profile.fold(session_end, folded, 70, "auto", nan, "right", width, "delta", poc_color, va_color, "auto")
profile.fold(last_bar && in_session, folded, 70, "auto", nan, "right", width, "delta", poc_color, va_color, "auto")
let open_price: float = session.open(window, "America/New_York")
if last_bar && in_session {
profile.row_color(open_price, color.yellow)
}
let top_volume: float = cell.max_volume()
let top_delta: float = math.max(nz(cell.max_delta(), 0), 1)
for i = 0 to cell.count() - 1 by 1 {
let p: float = cell.price(i)
let shade: color = color.from_gradient(cell.delta(i), -top_delta, top_delta, sell_color, buy_color)
plot.hbar(p, p, cell.volume(i), top_volume, i == cell.poc_index() ? poc_color : shade, "right", ladder_px)
}
plot.table(0, 0, "Bar delta", "#9CA3AF")
plot.table(0, 1, format.compact(tape.delta()), tape.delta() >= 0 ? buy_color : sell_color)