Skip to content

Volume ​

Alpha or TAO volume coloured by bar direction, with MA.

Kind indicator · Drawn in its own pane

Try it ​

On the chart, press / and choose Volume under Volume. To change it, copy the source below into the AlphaScript editor.

Inputs ​

InputTypeDefault
Unitselect"alpha"
MA lengthint20
Up colorcolor"rgba(8,153,129,0.5)"
Down colorcolor"rgba(242,54,69,0.5)"
MA colorcolor"#2962FF"

Source ​

From packages/alphascript/indicators/volume.as.js.

js
indicator({ name: "Volume", shortTitle: "Vol", overlay: false, format: "volume" });
const unit = input.select("Unit", "alpha", ["alpha", "tao"]);
const maLength = input.int("MA length", 20, { min: 1 });
const v = unit === "tao" ? candle.turnover : candle.volume;
plot(v, { title: "Volume", style: "columns", colorBy: "candle",
          colorUp: input.color("Up color", "rgba(8,153,129,0.5)", { group: "Style" }), colorDown: input.color("Down color", "rgba(242,54,69,0.5)", { group: "Style" }) });
plot(ta.sma(v, maLength), { title: "Volume MA", color: input.color("MA color", "#2962FF", { group: "Style" }) });

AlphaScript language v0.1 · runtime 0.2.0