Appearance
Keltner Channels
EMA basis with ATR bands.
Kind indicator · Drawn on the price pane
Try it
On the chart, press / and choose Keltner Channels under Bands & channels. To change it, copy the source below into the AlphaScript editor.
Inputs
| Input | Type | Default |
|---|---|---|
| Length | int | 20 |
| Multiplier | float | 2 |
| Source | source | "close" |
| ATR length | int | 10 |
| Upper color | color | "#2962FF" |
| Basis color | color | "#2962FF" |
| Lower color | color | "#2962FF" |
| Background | color | "rgba(33,150,243,0.05)" |
Source
From packages/alphascript/indicators/keltner.as.js.
js
indicator({ name: "Keltner Channels", shortTitle: "KC", overlay: true });
const length = input.int("Length", 20, { min: 1 });
const mult = input.float("Multiplier", 2, { step: 0.1 });
const src = input.source("Source", "close");
const atrLength = input.int("ATR length", 10, { min: 1 });
const basis = ta.ema(src, length), range = ta.atr(atrLength);
const upper = ta.calc([basis, range], (b, r) => b + mult * r), lower = ta.calc([basis, range], (b, r) => b - mult * r);
plot(upper, { title: "Upper", color: input.color("Upper color", "#2962FF", { group: "Style" }) });
plot(basis, { title: "Basis", color: input.color("Basis color", "#2962FF", { group: "Style" }) });
plot(lower, { title: "Lower", color: input.color("Lower color", "#2962FF", { group: "Style" }) });
fill(upper, lower, { title: "Background", color: input.color("Background", "rgba(33,150,243,0.05)", { group: "Style" }) });