Appearance
Know Sure Thing
Know Sure Thing: weighted sum of four smoothed rates of change.
Kind indicator · Drawn in its own pane
Try it
On the chart, press / and choose Know Sure Thing under Oscillators. To change it, copy the source below into the AlphaScript editor.
Inputs
| Input | Type | Default |
|---|---|---|
| ROC length #1 | int | 10 |
| ROC length #2 | int | 15 |
| ROC length #3 | int | 20 |
| ROC length #4 | int | 30 |
| SMA length #1 | int | 10 |
| SMA length #2 | int | 10 |
| SMA length #3 | int | 10 |
| SMA length #4 | int | 15 |
| Signal line length | int | 9 |
| KST color | color | "#089981" |
| Signal color | color | "#F23645" |
Source
From packages/alphascript/indicators/kst.as.js.
js
indicator({ name: "Know Sure Thing", shortTitle: "KST", overlay: false, precision: 4 });
const roc1 = input.int("ROC length #1", 10, { min: 1 }), roc2 = input.int("ROC length #2", 15, { min: 1 });
const roc3 = input.int("ROC length #3", 20, { min: 1 }), roc4 = input.int("ROC length #4", 30, { min: 1 });
const sma1 = input.int("SMA length #1", 10, { min: 1 }), sma2 = input.int("SMA length #2", 10, { min: 1 });
const sma3 = input.int("SMA length #3", 10, { min: 1 }), sma4 = input.int("SMA length #4", 15, { min: 1 });
const signalLength = input.int("Signal line length", 9, { min: 1 });
const c = candle.close;
const kst = ta.calc([ta.sma(ta.roc(c, roc1), sma1), ta.sma(ta.roc(c, roc2), sma2), ta.sma(ta.roc(c, roc3), sma3), ta.sma(ta.roc(c, roc4), sma4)],
(a, b, d, e) => a + 2 * b + 3 * d + 4 * e);
plot(kst, { title: "KST", color: input.color("KST color", "#089981", { group: "Style" }) });
plot(ta.sma(kst, signalLength), { title: "Signal", color: input.color("Signal color", "#F23645", { group: "Style" }) });
hline(0, { title: "Zero", color: "rgba(120,123,134,0.5)", style: "dashed" });