What is the Know Sure Thing (KST)?
The Know Sure Thing (KST), developed by Martin Pring, is a momentum indicator that effectively smooths and combines four different Rates of Change (ROC) from varying timeframes. This unique construction aims to provide a reliable measure of long-term momentum, filtering out short-term noise and giving clearer signals for major trend reversals. KST typically oscillates around a zero line and also includes a signal line (a smoothed version of KST itself).
In Pine Script, KST is a powerful tool for traders seeking a nuanced and smoothed view of market momentum, making it excellent for identifying significant shifts in trend direction and confirming price action over longer periods.
Components and Calculation
The calculation of KST is quite involved, combining four different ROC values, each smoothed by an SMA, and then adding them together. Finally, the KST line itself is smoothed to create a signal line.
- Four Rates of Change (ROC):
- `ROC1 = ROC(close, 10)`
- `ROC2 = ROC(close, 15)`
- `ROC3 = ROC(close, 20)`
- `ROC4 = ROC(close, 30)`
- Four Smoothed Rates of Change (SMA): Each ROC is then smoothed with a Simple Moving Average.
- `SMAROC1 = SMA(ROC1, 10)`
- `SMAROC2 = SMA(ROC2, 10)`
- `SMAROC3 = SMA(ROC3, 10)`
- `SMAROC4 = SMA(ROC4, 15)`
- KST Line Calculation: The KST line is the sum of these four smoothed ROCs.
`KST = (SMAROC1 * 1) + (SMAROC2 * 2) + (SMAROC3 * 3) + (SMAROC4 * 4)`
(Note: The weights 1, 2, 3, 4 are standard, but sometimes different weights are used depending on the source or specific implementation of Pring's methods.) - KST Signal Line: A Simple Moving Average of the KST line.
`Signal Line = SMA(KST, SignalLength)` (e.g., 9 periods)
This multi-faceted approach makes KST a highly reliable trend-following oscillator.
Basic Know Sure Thing (KST) Implementation in Pine Script
Pine Script v5 provides a built-in function `ta.kst()` for calculating the Know Sure Thing, simplifying its complex formula.
//@version=5
indicator("My Know Sure Thing (KST) Indicator", overlay=false) // overlay=false to plot in a separate pane
// Inputs for KST lengths (standard parameters by Martin Pring)
roc1Length = input.int(10, title="ROC1 Length", minval=1)
sma1Length = input.int(10, title="SMA1 Length", minval=1)
roc2Length = input.int(15, title="ROC2 Length", minval=1)
sma2Length = input.int(10, title="SMA2 Length", minval=1)
roc3Length = input.int(20, title="ROC3 Length", minval=1)
sma3Length = input.int(10, title="SMA3 Length", minval=1)
roc4Length = input.int(30, title="ROC4 Length", minval=1)
sma4Length = input.int(15, title="SMA4 Length", minval=1)
signalLength = input.int(9, title="Signal Length", minval=1)
// Calculate KST and its signal line using the built-in function
// ta.kst takes all the specific lengths for its internal calculation
[kstValue, signalValue] = ta.kst(close, roc1Length, sma1Length, roc2Length, sma2Length, roc3Length, sma3Length, roc4Length, sma4Length, signalLength)
// Plot the KST line
plot(kstValue, title="KST", color=color.blue, linewidth=2)
// Plot the Signal Line
plot(signalValue, title="Signal", color=color.orange, linewidth=2)
// Plot the Zero Line
hline(0, "Zero Line", color.gray, linestyle=hline.style_dotted)
Practical KST Trading Strategies
1. KST and Signal Line Crossover
This is the primary way to generate trading signals with KST. A crossover between the KST line and its signal line indicates a shift in momentum, confirming trend direction.
- Buy Signal: KST line crosses above its signal line. This indicates a strengthening of bullish momentum.
- Sell Signal: KST line crosses below its signal line. This indicates a strengthening of bearish momentum.
//@version=5
strategy("KST Crossover Strategy", overlay=true)
// Inputs for KST lengths (standard parameters by Martin Pring)
roc1Length = input.int(10, title="ROC1 Length", minval=1)
sma1Length = input.int(10, title="SMA1 Length", minval=1)
roc2Length = input.int(15, title="ROC2 Length", minval=1)
sma2Length = input.int(10, title="SMA2 Length", minval=1)
roc3Length = input.int(20, title="ROC3 Length", minval=1)
sma3Length = input.int(10, title="SMA3 Length", minval=1)
roc4Length = input.int(30, title="ROC4 Length", minval=1)
sma4Length = input.int(15, title="SMA4 Length", minval=1)
signalLength = input.int(9, title="Signal Length", minval=1)
// Calculate KST and its signal line
[kstValue, signalValue] = ta.kst(close, roc1Length, sma1Length, roc2Length, sma2Length, roc3Length, sma3Length, roc4Length, sma4Length, signalLength)
// Plot KST and Signal in a separate pane for visualization
plot(kstValue, "KST", color.blue, display=display.pane_only)
plot(signalValue, "Signal", color.orange, display=display.pane_only)
hline(0, "Zero Line", color.gray, linestyle=hline.style_dotted, display=display.pane_only)
// Define conditions for entries
longSignal = ta.crossover(kstValue, signalValue)
shortSignal = ta.crossunder(kstValue, signalValue)
// Strategy entries/exits
if (longSignal)
strategy.entry("Long", strategy.long)
if (shortSignal)
strategy.entry("Short", strategy.short)
2. KST Zero Line Crossover (Trend Confirmation)
The zero line provides a confirmation of the overall market bias. Crossing above zero indicates bullish momentum, and crossing below zero indicates bearish momentum.
- Bullish Trend Confirmation: KST crosses above the zero line. This suggests a shift to positive long-term momentum.
- Bearish Trend Confirmation: KST crosses below the zero line. This suggests a shift to negative long-term momentum.
//@version=5
strategy("KST Zero Line Crossover Strategy", overlay=true)
// Inputs for KST lengths
roc1Length = input.int(10, title="ROC1 Length", minval=1)
sma1Length = input.int(10, title="SMA1 Length", minval=1)
roc2Length = input.int(15, title="ROC2 Length", minval=1)
sma2Length = input.int(10, title="SMA2 Length", minval=1)
roc3Length = input.int(20, title="ROC3 Length", minval=1)
sma3Length = input.int(10, title="SMA3 Length", minval=1)
roc4Length = input.int(30, title="ROC4 Length", minval=1)
sma4Length = input.int(15, title="SMA4 Length", minval=1)
signalLength = input.int(9, title="Signal Length", minval=1) // Signal not used for this strategy
// Calculate KST (signal line is not relevant for this zero-line strategy, but calculated by ta.kst)
[kstValue, signalValue] = ta.kst(close, roc1Length, sma1Length, roc2Length, sma2Length, roc3Length, sma3Length, roc4Length, sma4Length, signalLength)
// Plot KST in a separate pane
plot(kstValue, "KST", color.blue, display=display.pane_only)
hline(0, "Zero Line", color.gray, linestyle=hline.style_dotted, display=display.pane_only)
// Define conditions for entries
longSignal = ta.crossover(kstValue, 0)
shortSignal = ta.crossunder(kstValue, 0)
// Strategy entries/exits
if (longSignal)
strategy.entry("Long", strategy.long)
if (shortSignal)
strategy.entry("Short", strategy.short)
3. KST Divergence Strategy
Divergence between price and KST is a highly reliable signal for significant trend reversals. Because KST is so heavily smoothed, its divergence signals are often less frequent but more powerful.
- Bullish Divergence: Price makes a lower low, but KST makes a higher low. This indicates weakening bearish momentum and a strong potential upward reversal.
- Bearish Divergence: Price makes a higher high, but KST makes a lower high. This indicates weakening bullish momentum and a strong potential downward reversal.
//@version=5
indicator("KST Divergence Scanner", overlay=true)
// Inputs for KST lengths
roc1Length = input.int(10, title="ROC1 Length", minval=1)
sma1Length = input.int(10, title="SMA1 Length", minval=1)
roc2Length = input.int(15, title="ROC2 Length", minval=1)
sma2Length = input.int(10, title="SMA2 Length", minval=1)
roc3Length = input.int(20, title="ROC3 Length", minval=1)
sma3Length = input.int(10, title="SMA3 Length", minval=1)
roc4Length = input.int(30, title="ROC4 Length", minval=1)
sma4Length = input.int(15, title="SMA4 Length", minval=1)
signalLength = input.int(9, title="Signal Length", minval=1)
// Calculate KST and its signal line
[kstValue, signalValue] = ta.kst(close, roc1Length, sma1Length, roc2Length, sma2Length, roc3Length, sma3Length, roc4Length, sma4Length, signalLength)
// Plot KST and Signal in a separate pane
plot(kstValue, "KST", color.blue)
plot(signalValue, "Signal", color.orange)
hline(0, "Zero Line", color.gray, linestyle=hline.style_dotted)
// Simple divergence detection (conceptual, robust detection requires advanced pivot logic)
// This is a simplified example focusing on price vs KST divergence.
// Bullish Divergence (Price lower low, KST higher low)
bullishDivergence = close[2] > close[1] and close[1] > close and kstValue[2] < kstValue[1] and kstValue[1] < kstValue
// Bearish Divergence (Price higher high, KST lower high)
bearishDivergence = close[2] < close[1] and close[1] < close and kstValue[2] > kstValue[1] and kstValue[1] > kstValue
plotshape(bullishDivergence, title="Bullish Divergence", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(bearishDivergence, title="Bearish Divergence", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.small)
alertcondition(bullishDivergence, "Bullish KST Divergence", "Potential bullish reversal based on KST divergence.")
alertcondition(bearishDivergence, "Bearish KST Divergence", "Potential bearish reversal based on KST divergence.")
Optimizing KST Performance
To get the most from the Know Sure Thing (KST) in Pine Script:
- Standard Parameters are Recommended: Martin Pring developed KST with specific default lengths (10,15,20,30 for ROCs and 10,10,10,15 for SMAs, plus 9 for the signal line). These parameters are generally well-tuned for identifying longer-term trends and are a good starting point. Adjusting them too much can alter the indicator's intended behavior.
- Focus on Crossovers and Divergence: KST is particularly effective for KST/Signal line crossovers as trend confirmation and for divergence signals, which are often more reliable due to the indicator's smoothing.
- Multi-Timeframe Analysis: KST is inherently designed for longer-term analysis due to its multiple ROC components. It's best used on higher timeframes (daily, weekly) for identifying dominant trends and then confirmed by price action or other indicators on lower timeframes for entry/exit timing.
- Combine with Price Action: Always seek confirmation from price action. A KST signal gains credibility if it aligns with a break of support/resistance, a strong candlestick pattern, or a significant volume spike.
- Not for Short-Term Noise: KST is designed to filter noise. It is less suited for very short-term or scalping strategies, as its signals will inherently lag more than faster oscillators.
Common KST Pitfalls
- Lag: Despite its complexity, KST is still a lagging indicator due to its multiple smoothing layers. It will not pick tops and bottoms precisely.
- Not for Sideways Markets: In prolonged choppy or range-bound markets, KST can still generate false signals or hover around the zero line, providing little actionable insight. It performs best in trending environments.
- Complex Calculation: While Pine Script simplifies it, understanding the multi-layered calculation is important for proper interpretation and advanced customization.
- Divergence Can Be Early: As with most divergence signals, KST divergence can appear before a reversal fully takes hold, requiring patience and additional confirmation.
- Not a Standalone Indicator: KST should always be used as part of a broader trading system, complementing other technical analysis tools for trend confirmation and risk management.
Conclusion
The Know Sure Thing (KST) is a sophisticated and highly insightful momentum indicator in Pine Script for TradingView. Its unique construction, which combines and smooths multiple Rates of Change, makes it particularly effective at identifying long-term trend shifts and reliable reversal signals through its crossovers and divergence patterns. By understanding its calculation, thoughtfully utilizing its standard parameters, and integrating it strategically within your comprehensive trading approach, you can leverage the KST to gain a deeper, noise-filtered understanding of market dynamics and enhance your trading decisions, especially for position or swing trading.
Enhance Your Trading
Get a high-performance Pine Script analysis tool for actionable market insights, designed for traders on the move.
This strategy runs in live mode on TradingView, helping you identify potential opportunities.
Subscribe now @ $99/month