Appearance
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
| Input | Type | Default |
|---|---|---|
| Unit | select | "alpha" |
| MA length | int | 20 |
| Up color | color | "rgba(8,153,129,0.5)" |
| Down color | color | "rgba(242,54,69,0.5)" |
| MA color | color | "#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" }) });