Bentrix Docs
HomePricingDashboard

Know Sure Thing KST

Oscillatorsoscillator2 linesin every package

Four rates of change over growing periods, each smoothed by its own simple average and weighted one to four, summed into one line, with a signal line that is its average.

It measures momentum across four horizons at once.

01The study, live

Live figureScroll to zoom, drag the bars to pan.
0
bar —O — H — L — C —main line —signal —first value at —
Show where:

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 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

The bars it readseach bar's close, unless you chooseanother priceWarm-upno value on the first 52 bars: thestudy needs them before it cananswerThe main linethe study's own value on each barThe second linedrawn with the main line: its signalor its partnerThe zero linethe centre line: where the studychanges sign
Computed by Bentrix’s own code over the sample bars. It is drawn on once, as you reach the figure.

03What you see

A smooth momentum line with a signal: four rates of change of different lengths, each smoothed and weighted.

KST is two lines around zero in a pane of its own: the KST line and its signal, a simple average of it. Both move in long, slow waves; the line is above zero while the weighted sum of the four rates of change is positive, which on daily bars means price is higher than it was one to two months ago on balance.

04Where it comes from

Martin Pring introduced it in the early 1990s and describes it in Technical Analysis Explained.

05The formula

KST=∑k=14wk·SMA(ROC(rk),sk)
ROC(rk)the rate of change over rk bars
skthe smoothing of each, in bars
wkthe weights 1, 2, 3, 4

with weights 1, 2, 3, 4 on increasingly long horizons.

06A worked example

Take one bar on which the four smoothed rates of change read:

  • ROC 10, averaged over 10 bars: 1.20 %
  • ROC 15, averaged over 10 bars: 1.80 %
  • ROC 20, averaged over 10 bars: 2.50 %
  • ROC 30, averaged over 15 bars: 3.10 %

KST = 1 × 1.20 + 2 × 1.80 + 3 × 2.50 + 4 × 3.10 = 1.20 + 3.60 + 7.50 + 12.40 = 24.70

The longest rate of change supplies half the total. That weighting is Pring's point: the long cycles dominate, and the short ones only shade the line's turns. The signal is a 9-bar simple average of the KST.

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: on the last bar the four read 2.167, 2.000, 8.712 and 11.265 %, and KST = 1 × 2.167 + 2 × 2.000 + 3 × 8.712 + 4 × 11.265 = 77.36.

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.

THE SCRIPT’S GRAPH
//@version=6
indicator("Know Sure Thing")
roc1 = input.int(10, "ROC 1")
roc2 = input.int(15, "ROC 2")
roc3 = input.int(20, "ROC 3")
roc4 = input.int(30, "ROC 4")
sma1 = input.int(10, "SMA 1")
sma2 = input.int(10, "SMA 2")
sma3 = input.int(10, "SMA 3")
sma4 = input.int(15, "SMA 4")
signalLength = input.int(9, "Signal")
// Four rates of change, in percent, each smoothed by its own simple average.
leg1 = ta.sma((close / close[roc1] - 1) * 100, sma1)
leg2 = ta.sma((close / close[roc2] - 1) * 100, sma2)
leg3 = ta.sma((close / close[roc3] - 1) * 100, sma3)
leg4 = ta.sma((close / close[roc4] - 1) * 100, sma4)
// The longer legs weigh more.
kst = leg1 * 1 + leg2 * 2 + leg3 * 3 + leg4 * 4
signal = ta.sma(kst, signalLength)
// Both lines appear once the signal has its first value.
plot(na(signal) ? na : kst, "KST")
plot(signal, "Signal")

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. Pring read the crossing as a change in the summed momentum. With eight windows inside, the line is slow: crossings come long after turns, and a trend that pauses and resumes produces a pair of them for nothing.

How the zero line fails. Zero is where the weighted sum of four rates of change changes sign — an even later event.

09In different markets and timeframes

The KST sums four smoothed rates of change, the longest weighted most: a slow momentum line for major trends. Pring designed sets for daily, weekly and monthly charts.

Its longest rate of change is 30 bars smoothed over 15, so the daily set looks back about nine weeks and turns a few times a year. On M5 the same numbers span under four hours and the line turns several times a day, with none of the weight Pring gave a turn on a weekly or monthly chart. In a long trend it stays on one side of zero and of its signal for months; in a broad range it crosses its signal at each swing, late. It is unbounded, so its level is compared only with its own past on the same instrument.

10With other studies

Read with its 9-bar signal; beside the Coppock curve, a simpler sum of two rates of change.

11What it does not tell you

!

It summarises four horizons of past change; agreement between them describes the past.

12Inputs and defaults

KST (10, 15)settings card
1ROC-1 Period10
2ROC-2 Period15
3ROC-3 Period20
4ROC-4 Period30
5SMA-1 Period10
6SMA-2 Period10
7SMA-3 Period10
8SMA-4 Period15
9Signal Period9
10Applied priceClose
11TimeframeChart
12Wait for the candle to closeOn
  1. 1
    ROC-1 Period — 10Rate-of-change period of leg 1
  2. 2
    ROC-2 Period — 15Rate-of-change period of leg 2
  3. 3
    ROC-3 Period — 20Rate-of-change period of leg 3
  4. 4
    ROC-4 Period — 30Rate-of-change period of leg 4
  5. 5
    SMA-1 Period — 10Smoothing period of leg 1
  6. 6
    SMA-2 Period — 10Smoothing period of leg 2
  7. 7
    SMA-3 Period — 10Smoothing period of leg 3
  8. 8
    SMA-4 Period — 15Smoothing period of leg 4
  9. 9
    Signal Period — 9Smoothing period of the signal line
  10. 10
    Applied price — CloseAny of the seven prices, and several at once, each its own line with its own look.
  11. 11
    Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
  12. 12
    Wait 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 Period … ROC-4 PeriodThe four look-backs of the rates of change (10, 15, 20, 30), weighted 1, 2, 3 and 4.
  • SMA-1 Period … SMA-4 PeriodThe simple average that smooths each rate of change (10, 10, 10, 15).
  • Signal PeriodThe simple average of the KST drawn beside it (9).
  • In use10/15/20/30 smoothed by 10/10/10/15 is Pring's daily set.

13Limits and common misreadings

Long warm-up: the longest ROC plus its average, 45 bars with the defaults, before the first value.

Nine parameters. Pring published different sets for daily, weekly and monthly charts; the defaults are his daily set.

Simple averages inside: old bars leaving any of eight windows nudge the line.

14Conditions an alert or a strategy can watch

crosses above 0 eventcrosses below 0 eventis above 0 stateis below 0 statecrosses above its signal line eventcrosses below its signal line eventis above its signal line stateis below its signal line state

Event: the bar it happens on an event happens on one barState: every bar while it holds 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 with its defaults under a daily chart and mark each crossing of its signal over two years; note the distance in bars between each price turn and its crossing.

Open the laboratory

17On pages of their own

18In Bentrix

  • From the menu: a chart's Indicators button › Oscillators › KST, or type KST in its search.
  • Its settings: the settings card opens when it is added; its legend's name opens it again.

19From 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"}).

The study, as a chart files it

This is a new KST’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",
  "settings": {
    "shape": "ta",
    "values": {
      "optInROC1Period": 10.0,
      "optInROC2Period": 15.0,
      "optInROC3Period": 20.0,
      "optInROC4Period": 30.0,
      "optInSMA1Period": 10.0,
      "optInSMA2Period": 10.0,
      "optInSMA3Period": 10.0,
      "optInSMA4Period": 15.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",
      "settings": {
        "shape": "ta",
        "values": {
          "optInROC1Period": 10.0,
          "optInROC2Period": 15.0,
          "optInROC3Period": 20.0,
          "optInROC4Period": 30.0,
          "optInSMA1Period": 10.0,
          "optInSMA2Period": 10.0,
          "optInSMA3Period": 10.0,
          "optInSMA4Period": 15.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", "settings": {"shape": "ta", "values": {"optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInSMA1Period": 10.0, "optInSMA2Period": 10.0, "optInSMA3Period": 10.0, "optInSMA4Period": 15.0, "optInSignalPeriod": 9.0}}}, limit=5)
print("times:", values["times"])
for line in values["lines"]:
    print("line:", line["line"])
    print("  newest values:", line["values"])

JSJavaScript

const values = await client.study.values({ bench, symbol: market, timeframe: "H1", study: { "applied": "close", "convention": "talib", "kind": "kst", "settings": { "shape": "ta", "values": { "optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInSMA1Period": 10.0, "optInSMA2Period": 10.0, "optInSMA3Period": 10.0, "optInSMA4Period": 15.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#C#

var values = await client.Study.Values(bench, market, "H1", new Dictionary<string, object?> { ["applied"] = "close", ["convention"] = "talib", ["kind"] = "kst", ["settings"] = new Dictionary<string, object?> { ["shape"] = "ta", ["values"] = new Dictionary<string, object?> { ["optInROC1Period"] = 10.0, ["optInROC2Period"] = 15.0, ["optInROC3Period"] = 20.0, ["optInROC4Period"] = 30.0, ["optInSMA1Period"] = 10.0, ["optInSMA2Period"] = 10.0, ["optInSMA3Period"] = 10.0, ["optInSMA4Period"] = 15.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"]!}");
}

GOGo

values := must(client.Study.Values(ctx, mcp.StudyValuesArgs{Bench: bench, Symbol: market, Timeframe: "H1", Study: map[string]any{"applied": "close", "convention": "talib", "kind": "kst", "settings": map[string]any{"shape": "ta", "values": map[string]any{"optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInSMA1Period": 10.0, "optInSMA2Period": 10.0, "optInSMA3Period": 10.0, "optInSMA4Period": 15.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", "settings", obj("shape", "ta", "values", obj("optInROC1Period", 10.0, "optInROC2Period", 15.0, "optInROC3Period", 20.0, "optInROC4Period", 30.0, "optInSMA1Period", 10.0, "optInSMA2Period", 10.0, "optInSMA3Period", 10.0, "optInSMA4Period", 15.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++C++

auto values = client.study.values_(StudyApi::ValuesArgs(bench, market, "H1", Json::Object{{"applied", "close"}, {"convention", "talib"}, {"kind", "kst"}, {"settings", Json::Object{{"shape", "ta"}, {"values", Json::Object{{"optInROC1Period", 10.0}, {"optInROC2Period", 15.0}, {"optInROC3Period", 20.0}, {"optInROC4Period", 30.0}, {"optInSMA1Period", 10.0}, {"optInSMA2Period", 10.0}, {"optInSMA3Period", 10.0}, {"optInSMA4Period", 15.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", "settings" => Dict{String,Any}("shape" => "ta", "values" => Dict{String,Any}("optInROC1Period" => 10.0, "optInROC2Period" => 15.0, "optInROC3Period" => 20.0, "optInROC4Period" => 30.0, "optInSMA1Period" => 10.0, "optInSMA2Period" => 10.0, "optInSMA3Period" => 10.0, "optInSMA4Period" => 15.0, "optInSignalPeriod" => 9.0))); limit = 5)
println("times:", " ", values["times"])
for line in values["lines"]
    println("line:", " ", line["line"])
    println("  newest values:", " ", line["values"])
end

RR

values <- client$study$values(bench, market, "H1", list(applied = "close", convention = "talib", kind = "kst", settings = list(shape = "ta", values = list(optInROC1Period = 10.0, optInROC2Period = 15.0, optInROC3Period = 20.0, optInROC4Period = 30.0, optInSMA1Period = 10.0, optInSMA2Period = 10.0, optInSMA3Period = 10.0, optInSMA4Period = 15.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")
}

RRust

let values = client.study().values(mcp::StudyValuesArgs::new(bench.clone(), market.clone(), "H1", serde_json::json!({"applied": "close", "convention": "talib", "kind": "kst", "settings": {"shape": "ta", "values": {"optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInSMA1Period": 10.0, "optInSMA2Period": 10.0, "optInSMA3Period": 10.0, "optInSMA4Period": 15.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 its line name and its values; values[i] belongs to the candle at times[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.
  • null is 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].
lineWhat it is
Mainthe indicator's own value
Signala 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: {"kst": {"applied": "close", "convention": "talib", "kind": "kst", "settings": {"shape": "ta", "values": {"optInROC1Period": 10.0, "optInROC2Period": 15.0, "optInROC3Period": 20.0, "optInROC4Period": 30.0, "optInSMA1Period": 10.0, "optInSMA2Period": 10.0, "optInSMA3Period": 10.0, "optInSMA4Period": 15.0, "optInSignalPeriod": 9.0}}}} — its rules can name:

WriteWhat it is
kstits main line, as a value in a compare
kst.signalthis line, as a value in a compare
{"cond": "kst:level.cross_up:0"}a condition it declares itself
{"cond": "kst:level.cross_down:0"}a condition it declares itself
{"cond": "kst:level.above:0"}a condition it declares itself
{"cond": "kst:level.below:0"}a condition it declares itself
{"cond": "kst:signal.cross_up"}a condition it declares itself
{"cond": "kst:signal.cross_down"}a condition it declares itself
{"cond": "kst:signal.above"}a condition it declares itself
{"cond": "kst:signal.below"}a condition it declares itself

20Sources

  1. Pring, Martin J. Technical Analysis Explained, 4th ed. McGraw-Hill, 2002.
  2. Pring, Martin J. "Summed Rate of Change (KST)." Technical Analysis of Stocks & Commodities, September 1992.

Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed