Appearance
Chande Kroll Stop
Stops from the N-bar extreme minus ATR, for longs and shorts.
Kind indicator · Drawn on the price pane
Try it
On the chart, press / and choose Chande Kroll Stop under Trend. To change it, copy the source below into the AlphaScript editor.
Inputs
| Input | Type | Default |
|---|---|---|
| ATR length | int | 10 |
| ATR coefficient | float | 1 |
| Stop length | int | 9 |
| Stop short color | color | "#FF6D00" |
| Stop long color | color | "#2962FF" |
Source
From packages/alphascript/indicators/ckstop.as.js.
js
indicator({ name: "Chande Kroll Stop", shortTitle: "CKS", overlay: true });
const p = input.int("ATR length", 10, { min: 1 }), x = input.float("ATR coefficient", 1, { step: 0.1 }), q = input.int("Stop length", 9, { min: 1 });
const atr = ta.atr(p);
const highStop = ta.calc([ta.highest(candle.high, p), atr], (h, a) => h - x * a), lowStop = ta.calc([ta.lowest(candle.low, p), atr], (l, a) => l + x * a);
plot(ta.highest(highStop, q), { title: "Stop Short", color: input.color("Stop short color", "#FF6D00", { group: "Style" }) });
plot(ta.lowest(lowStop, q), { title: "Stop Long", color: input.color("Stop long color", "#2962FF", { group: "Style" }) });