Appearance
Rate Of Change
Percent change over N bars.
Kind indicator · Drawn in its own pane
Try it
On the chart, press / and choose Rate Of Change under Oscillators. To change it, copy the source below into the AlphaScript editor.
Inputs
| Input | Type | Default |
|---|---|---|
| Length | int | 9 |
| Source | source | "close" |
| Color | color | "#2962FF" |
Source
From packages/alphascript/indicators/roc.as.js.
js
indicator({ name: "Rate Of Change", shortTitle: "ROC", overlay: false, precision: 2 });
const length = input.int("Length", 9, { min: 1 });
plot(ta.roc(input.source("Source", "close"), length), { title: "ROC", color: input.color("Color", "#2962FF", { group: "Style" }) });
hline(0, { title: "Zero line", color: "#787B86" });