feature
Volume
Public library indicator Volume (volume). Same source as the Chartnaut-owned row in the live indicator table.
What it plots
A histogram pane of bar volume, colored by whether the bar closed up or down.
Key decisions
Piece | Why it matters |
|---|---|
| Puts the series in its own pane as bars, not a line on price. |
| Histogram color follows the up/down color inputs per bar. |
| One plot per bar — no warmup buffers needed. |
Full script
meta({
shortName: "Volume",
kind: "histogram",
dataSource: "candles",
category: "custom",
});
dialog({
title: "Volume Configuration",
description: "Configure Volume indicator settings",
width: 400,
height: 300,
resizable: false,
showEnabledCheckbox: true,
resetToDefaults: {
enabled: true,
confirmationMessage: "Are you sure you want to reset all Volume settings to their default values?",
},
});
const upColor = input.color({
id: "upColor",
label: "Up Color",
default: "#26a69a",
allowAlpha: true,
});
const downColor = input.color({
id: "downColor",
label: "Down Color",
default: "#ef5350",
allowAlpha: true,
});
const labelsEnabled = input.boolean({
id: "labelsEnabled",
label: "Show Labels",
description: "Display volume values on chart",
default: true,
});
layout(
tab({ id: "appearance", title: "Appearance" },
section({ id: "colors", title: "Colors", columns: 2 }, upColor, downColor),
section({ id: "display", title: "Display Options" }, labelsEnabled),
),
);
output.histogram({
id: "volume",
colorFrom: upColor,
labelFrom: labelsEnabled,
titleWhenLabeled: "Volume",
});
/** @param {ScriptedCtx} ctx */
export function onBar(ctx) {
ctx.plot("volume", ctx.volume);
}