Know Sure Thing, its averages chosen (KST (MA))
Pring's four weighted rates of change, as in KST, with the average that smooths each leg and the signal chosen rather than simple.
It measures momentum across four horizons at once.
01The study, live
Computed by Bentrix’s own code over the same synthetic bars on every page — an illustration of how the study behaves, not a market.
What this figure shows
The figure is computed over 300 sample bars. KST (MA) has no value on the first 52 — the bars it needs before it can answer — and its first value stands on bar 53. Its line runs between -6.41 and 6.74 on these bars, and the last value is 1.93. Counting the conditions the study declares on these bars: crosses above 0 once; crosses below 0 once; crosses above its signal line 5 times; crosses below its signal line 6 times. Press a condition under the figure to see each place marked. As states rather than moments: is above 0 on 118 bars; is below 0 on 130 bars; is above its signal line on 95 bars; is below its signal line on 153 bars.
02Its parts, named
03What you see
KST (MA) is two lines around zero in a pane of its own: the KST line — four smoothed rates of change of different lengths, added with weights 1, 2, 3 and 4 — and its signal. It differs from the KST in one thing: the kind of average that smooths the four rates of change, and the kind used for the signal, are inputs.
04Where it comes from
Martin Pring introduced it in the early 1990s and describes it in Technical Analysis Explained.
05The formula
KST (MA) = Σ[k=1..4] wₖ · MAₐ(ROC(rₖ), sₖ), Signal = MA_b(KST (MA), g)
with weights of 1, 2, 3, 4 on increasingly long horizons (10, 15, 20, 30), each smoothed over bars (10, 10, 10, 15), and and the kind of average chosen for the four smoothings and for the signal.
06A worked example
KST (MA) is summed as the KST is. With four smoothed rates of change of 1.20, 1.80, 2.50 and 3.10 %:
KST (MA) = 1 × 1.20 + 2 × 1.80 + 3 × 2.50 + 4 × 3.10 = 24.70
What this version adds is the choice of average. With exponential averages in place of the simple ones, each smoothed rate of change reacts sooner to the newest bars — say 1.35, 1.90, 2.55 and 3.12 — and the sum becomes 1.35 + 3.80 + 7.65 + 12.48 = 25.28. The same market, the same periods, a different line.
On real closes — 20, 21, 23, 22, 24, 25, 24, 26 — with rates of change over 1, 2, 3 and 4 bars, each averaged over 2 bars: with simple averages the line reads 77.36 on the last bar, and with exponential ones 100.32 — the last close's rise of 8.33 % counts for more in an exponential average.
07Built in Assay
The same study written in Assay, Bentrix’s script language, and drawn by Bentrix itself as the script’s graph: each block is one step of the formula. On the ladder the steps stand in the script’s order, one a row; on the board each wire carries a value from the block that gives it to the block that reads it, left to right. The script computes exactly what the study computes — Bentrix checks the two against each other, candle by candle.
//@version=6 indicator("Know Sure Thing, its averages chosen") roc1Period = input.int(10, "ROC-1 Period") roc2Period = input.int(15, "ROC-2 Period") roc3Period = input.int(20, "ROC-3 Period") roc4Period = input.int(30, "ROC-4 Period") ma1Period = input.int(10, "MA-1 Period") ma2Period = input.int(10, "MA-2 Period") ma3Period = input.int(10, "MA-3 Period") ma4Period = input.int(15, "MA-4 Period") signalPeriod = input.int(9, "Signal Period") rocMa = input.float(0.0, "ROC MA") signalMa = input.float(0.0, "Signal MA") [kst, signal] = talib.KSTEXT(close, roc1Period, roc2Period, roc3Period, roc4Period, ma1Period, ma2Period, ma3Period, ma4Period, signalPeriod, rocMa, signalMa) // Four smoothed rates of change, weighted 1 to 4 and added; the averages' kind is chosen. plot(kst, "KST") plot(signal, "Signal") hline(0)
Paste it into the Assay IDE to put it on a chart, or to change it. Looking at the graph is free in every package; editing it as blocks is Plus.
08Readings — what traders look for
KST crossing its signal and crossing zero are read as momentum across several horizons turning together.
How the signal crossing fails. As with the KST: slow by construction, and doubled by every pause in a trend. A quicker kind of average brings the crossings sooner and adds more of them.
09In different markets and timeframes
KST (MA) is the KST with the kind of its averages open to choice; exponential averages make it quicker and livelier.
The choice of average does not change what it suits: long trends on higher timeframes. With exponential averages it turns a few bars sooner and makes more small crossings of its signal in a range; with weighted or double-exponential ones more still. On short timeframes, where the plain KST already turns several times a day, a quicker average adds crossings without adding moves to go with them.
10With other studies
Read beside the KST of the same periods.
11What it does not tell you
It summarises four horizons of past change; agreement between them describes the past.
12Inputs and defaults
- 1ROC-1 Period — 10Rate-of-change period of leg 1
- 2ROC-2 Period — 15Rate-of-change period of leg 2
- 3ROC-3 Period — 20Rate-of-change period of leg 3
- 4ROC-4 Period — 30Rate-of-change period of leg 4
- 5MA-1 Period — 10Smoothing period of leg 1
- 6MA-2 Period — 10Smoothing period of leg 2
- 7MA-3 Period — 10Smoothing period of leg 3
- 8MA-4 Period — 15Smoothing period of leg 4
- 9Signal Period — 9Smoothing period of the signal line
- 10ROC MA — 0Type of Moving Average smoothing the four legs
- 11Signal MA — 0Type of Moving Average for signal line
- 12Applied price — CloseAny of the seven prices, and several at once, each its own line with its own look.
- 13Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
- 14Wait for the candle to close — OnThe value of a higher timeframe is taken only from a candle that has finished.
What each input changes
- ROC-1 … ROC-4 PeriodThe four look-backs of the rates of change.
- MA-1 … MA-4 PeriodThe window of the average that smooths each.
- Signal PeriodThe window of the signal line.
- ROC MAThe kind of average that smooths the four rates of change.
- Signal MAThe kind of the signal's average.
- In useThe KST's periods; the kind of average for the four smoothings and for the signal.
13Limits and common misreadings
Eleven inputs. Two charts agree only if all of them do.
Long warm-up, as with the KST.
14Conditions an alert or a strategy can watch
an event happens on one bar a state holds on every bar while it lasts
These are the conditions the study itself declares — the same rules the alert editor and the strategy engine read, and the ones the figure's chips show.
15Practise it in the laboratory
Put KST and KST (MA) with exponential averages in two panes and compare where each crosses its signal.
Open the laboratory17In Bentrix
- From the menu: a chart's Indicators button › Oscillators › KST (MA), or type KST (MA) in its search.
- Its settings: the settings card opens when it is added; its legend's name opens it again.
18From an agent or a program
Two tools reach it. study_values computes it over a workbench’s candles up to the clock — no chart needed — and study_attach puts it on a chart, where it is drawn and saved with the chart ({"chart": "<chart uri>", "kind": "kst_ext"}).
The study, as a chart files it
This is a new KST (MA)’s entry — its kind, its calculation, the price it reads and its settings. Change a setting here to read it with other inputs.
{
"applied": "close",
"convention": "talib",
"kind": "kst_ext",
"settings": {
"shape": "ta",
"values": {
"optInMA1Period": 10.0,
"optInMA2Period": 10.0,
"optInMA3Period": 10.0,
"optInMA4Period": 15.0,
"optInROC1Period": 10.0,
"optInROC2Period": 15.0,
"optInROC3Period": 20.0,
"optInROC4Period": 30.0,
"optInROCMAType": 0.0,
"optInSignalMAType": 0.0,
"optInSignalPeriod": 9.0
}
}
}An agent
An agent calls the MCP tool with it:
{
"name": "study_values",
"arguments": {
"bench": "bentrix://lab/\u2026/bench/\u2026",
"symbol": "EURUSD",
"timeframe": "H1",
"limit": 5,
"study": {
"applied": "close",
"convention": "talib",
"kind": "kst_ext",
"settings": {
"shape": "ta",
"values": {
"optInMA1Period": 10.0,
"optInMA2Period": 10.0,
"optInMA3Period": 10.0,
"optInMA4Period": 15.0,
"optInROC1Period": 10.0,
"optInROC2Period": 15.0,
"optInROC3Period": 20.0,
"optInROC4Period": 30.0,
"optInROCMAType": 0.0,
"optInSignalMAType": 0.0,
"optInSignalPeriod": 9.0
}
}
}
}
}A program
A program does the same in its language — bench and market as in the built-in indicators guide:
Python
values = client.study.values(bench, market, "H1", {"applied": "close", "convention": "talib", "kind": "kst_ext", "settings": {"shape": "ta", "values": {"optInMA1Period": 10.0, "optInMA2Period": 10.0, "optInMA3Period": 10.0, "optInMA4Period": 15.0, "optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInROCMAType": 0.0, "optInSignalMAType": 0.0, "optInSignalPeriod": 9.0}}}, limit=5)
print("times:", values["times"])
for line in values["lines"]:
print("line:", line["line"])
print(" newest values:", line["values"])JavaScript
const values = await client.study.values({ bench, symbol: market, timeframe: "H1", study: { "applied": "close", "convention": "talib", "kind": "kst_ext", "settings": { "shape": "ta", "values": { "optInMA1Period": 10.0, "optInMA2Period": 10.0, "optInMA3Period": 10.0, "optInMA4Period": 15.0, "optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInROCMAType": 0.0, "optInSignalMAType": 0.0, "optInSignalPeriod": 9.0 } } }, limit: 5 });
console.log("times:", values.times);
for (const line of values.lines) {
console.log("line:", line.line);
console.log(" newest values:", line.values);
}C#
var values = await client.Study.Values(bench, market, "H1", new Dictionary<string, object?> { ["applied"] = "close", ["convention"] = "talib", ["kind"] = "kst_ext", ["settings"] = new Dictionary<string, object?> { ["shape"] = "ta", ["values"] = new Dictionary<string, object?> { ["optInMA1Period"] = 10.0, ["optInMA2Period"] = 10.0, ["optInMA3Period"] = 10.0, ["optInMA4Period"] = 15.0, ["optInROC1Period"] = 10.0, ["optInROC2Period"] = 15.0, ["optInROC3Period"] = 20.0, ["optInROC4Period"] = 30.0, ["optInROCMAType"] = 0.0, ["optInSignalMAType"] = 0.0, ["optInSignalPeriod"] = 9.0 } } }, limit: 5);
Console.WriteLine($"times: {values!["times"]!}");
foreach (var line in values!["lines"]!.AsArray())
{
Console.WriteLine($"line: {line!["line"]!}");
Console.WriteLine($" newest values: {line!["values"]!}");
}Go
values := must(client.Study.Values(ctx, mcp.StudyValuesArgs{Bench: bench, Symbol: market, Timeframe: "H1", Study: map[string]any{"applied": "close", "convention": "talib", "kind": "kst_ext", "settings": map[string]any{"shape": "ta", "values": map[string]any{"optInMA1Period": 10.0, "optInMA2Period": 10.0, "optInMA3Period": 10.0, "optInMA4Period": 15.0, "optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInROCMAType": 0.0, "optInSignalMAType": 0.0, "optInSignalPeriod": 9.0}}}, Limit: mcp.Ptr[int64](5)}))
fmt.Println("times:", at(values, "times"))
for _, line := range at(values, "lines").([]any) {
fmt.Println("line:", at(line, "line"))
fmt.Println(" newest values:", at(line, "values"))
}Java
Object values = client.study.values(new Bentrix.StudyApi.ValuesArgs(bench, market, "H1", obj("applied", "close", "convention", "talib", "kind", "kst_ext", "settings", obj("shape", "ta", "values", obj("optInMA1Period", 10.0, "optInMA2Period", 10.0, "optInMA3Period", 10.0, "optInMA4Period", 15.0, "optInROC1Period", 10.0, "optInROC2Period", 15.0, "optInROC3Period", 20.0, "optInROC4Period", 30.0, "optInROCMAType", 0.0, "optInSignalMAType", 0.0, "optInSignalPeriod", 9.0)))).limit(5L));
System.out.println("times:" + " " + at(values, "times"));
for (Object line : (List<Object>) at(values, "lines")) {
System.out.println("line:" + " " + at(line, "line"));
System.out.println(" newest values:" + " " + at(line, "values"));
}C++
auto values = client.study.values_(StudyApi::ValuesArgs(bench, market, "H1", Json::Object{{"applied", "close"}, {"convention", "talib"}, {"kind", "kst_ext"}, {"settings", Json::Object{{"shape", "ta"}, {"values", Json::Object{{"optInMA1Period", 10.0}, {"optInMA2Period", 10.0}, {"optInMA3Period", 10.0}, {"optInMA4Period", 15.0}, {"optInROC1Period", 10.0}, {"optInROC2Period", 15.0}, {"optInROC3Period", 20.0}, {"optInROC4Period", 30.0}, {"optInROCMAType", 0.0}, {"optInSignalMAType", 0.0}, {"optInSignalPeriod", 9.0}}}}}}).limit(5));
std::cout << "times:" << " " << values["times"].dump() << std::endl;
for (const Json &line : values["lines"].arr()) {
std::cout << "line:" << " " << line["line"].dump() << std::endl;
std::cout << " newest values:" << " " << line["values"].dump() << std::endl;
}Julia
values = client.study.values(bench, market, "H1", Dict{String,Any}("applied" => "close", "convention" => "talib", "kind" => "kst_ext", "settings" => Dict{String,Any}("shape" => "ta", "values" => Dict{String,Any}("optInMA1Period" => 10.0, "optInMA2Period" => 10.0, "optInMA3Period" => 10.0, "optInMA4Period" => 15.0, "optInROC1Period" => 10.0, "optInROC2Period" => 15.0, "optInROC3Period" => 20.0, "optInROC4Period" => 30.0, "optInROCMAType" => 0.0, "optInSignalMAType" => 0.0, "optInSignalPeriod" => 9.0))); limit = 5)
println("times:", " ", values["times"])
for line in values["lines"]
println("line:", " ", line["line"])
println(" newest values:", " ", line["values"])
endR
values <- client$study$values(bench, market, "H1", list(applied = "close", convention = "talib", kind = "kst_ext", settings = list(shape = "ta", values = list(optInMA1Period = 10.0, optInMA2Period = 10.0, optInMA3Period = 10.0, optInMA4Period = 15.0, optInROC1Period = 10.0, optInROC2Period = 15.0, optInROC3Period = 20.0, optInROC4Period = 30.0, optInROCMAType = 0.0, optInSignalMAType = 0.0, optInSignalPeriod = 9.0))), limit = 5)
cat("times:", format(values$times), "\n")
for (line in values$lines) {
cat("line:", format(line$line), "\n")
cat(" newest values:", format(line$values), "\n")
}Rust
let values = client.study().values(mcp::StudyValuesArgs::new(bench.clone(), market.clone(), "H1", serde_json::json!({"applied": "close", "convention": "talib", "kind": "kst_ext", "settings": {"shape": "ta", "values": {"optInMA1Period": 10.0, "optInMA2Period": 10.0, "optInMA3Period": 10.0, "optInMA4Period": 15.0, "optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInROCMAType": 0.0, "optInSignalMAType": 0.0, "optInSignalPeriod": 9.0}}})).limit(5))?;
println!("times: {}", values["times"]);
for line in values["lines"].as_array().into_iter().flatten() {
println!("line: {}", line["line"]);
println!(" newest values: {}", line["values"]);
}Reading the answer
times— the candles’ open times, in milliseconds since 1970 (UTC), oldest first.lines— one entry per line, in this order, each with itslinename and itsvalues;values[i]belongs to the candle attimes[i].- The last value is the candle at the clock’s, which may still be forming: it changes until that candle closes, as on the chart. Nothing after the clock is ever computed.
nullis a candle with no value yet — the warm-up, about 1 × the period at the start of the history.- Its fixed levels, drawn on the chart:
[0.0].
line | What it is |
|---|---|
Main | the indicator's own value |
Signal | a smoothing of the main line, drawn beside it |
In a strategy
Filed under a key of your choice in a strategy document’s studies — here kst_ext: {"kst_ext": {"applied": "close", "convention": "talib", "kind": "kst_ext", "settings": {"shape": "ta", "values": {"optInMA1Period": 10.0, "optInMA2Period": 10.0, "optInMA3Period": 10.0, "optInMA4Period": 15.0, "optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInROCMAType": 0.0, "optInSignalMAType": 0.0, "optInSignalPeriod": 9.0}}}} — its rules can name:
| Write | What it is |
|---|---|
kst_ext | its main line, as a value in a compare |
kst_ext.signal | this line, as a value in a compare |
{"cond": "kst_ext:level.cross_up:0"} | a condition it declares itself |
{"cond": "kst_ext:level.cross_down:0"} | a condition it declares itself |
{"cond": "kst_ext:level.above:0"} | a condition it declares itself |
{"cond": "kst_ext:level.below:0"} | a condition it declares itself |
{"cond": "kst_ext:signal.cross_up"} | a condition it declares itself |
{"cond": "kst_ext:signal.cross_down"} | a condition it declares itself |
{"cond": "kst_ext:signal.above"} | a condition it declares itself |
{"cond": "kst_ext:signal.below"} | a condition it declares itself |
19Sources
- Pring, Martin J. Technical Analysis Explained, 4th ed. McGraw-Hill, 2002.
Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed