OPEN-SOURCE SCRIPT
Long-term KST (Know Sure Thing)

Description
Long-term Know Sure Thing (KST) oscillator, specifically adapted for non-24h markets such as stocks, indices, ETFs and futures.
This version correctly scales the weekly ROC periods based on the actual trading week length and daily session duration of the instrument — making it accurate across different asset classes (European indices, US equities, crypto, etc.).
Key features:
• Fully customizable trading week (5 days for most stock markets, 7 days for crypto/24h markets)
• Customizable daily session length (8.5h for FTSE MIB/DAX, 6.5h for US equities, 24h for crypto/forex)
• Automatically adjusts bar count per week on any chart timeframe (including Weekly)
• Classic Martin Pring KST parameters (10/13/15/20 ROC weeks, 10/13/15/20 SMA weeks, 1-2-3-4 weighting)
• Includes signal line (SMA of KST) and visual fill between KST and signal (green/red)
What is the Long-term KST used for?
The KST (Know Sure Thing) is a momentum oscillator created by Martin Pring to detect major trend changes, confirm the primary trend direction, and identify significant reversals in medium- to long-term cycles (weeks to months).
Main practical uses:
• Major trend reversals: KST crossing above/below signal line
• Primary trend confirmation: KST above/below zero line
• Classic divergences: Price vs KST divergences often precede important tops/bottoms
• Cycle identification: Helps spot the end of multi-month corrections or the start of new bull/bear phases
• Trend-following filter: Stay long when KST > 0 and rising, stay short when KST < 0 and falling
It is especially powerful on major indices (FTSE MIB, DAX, SPX, NDX, RUT, CAC40, Nikkei…) because it captures institutional money flow with fewer, higher-quality signals compared to faster oscillators.
Best used on:
• Daily, 4H, Weekly charts
• European indices (FTSE MIB, DAX, IBEX…)
• US indices/ETFs (SPX, NDX, RUT…)
• Crypto pairs (set week_length=7, session_duration=24h)
Enjoy trading the big-picture momentum!
Long-term Know Sure Thing (KST) oscillator, specifically adapted for non-24h markets such as stocks, indices, ETFs and futures.
This version correctly scales the weekly ROC periods based on the actual trading week length and daily session duration of the instrument — making it accurate across different asset classes (European indices, US equities, crypto, etc.).
Key features:
• Fully customizable trading week (5 days for most stock markets, 7 days for crypto/24h markets)
• Customizable daily session length (8.5h for FTSE MIB/DAX, 6.5h for US equities, 24h for crypto/forex)
• Automatically adjusts bar count per week on any chart timeframe (including Weekly)
• Classic Martin Pring KST parameters (10/13/15/20 ROC weeks, 10/13/15/20 SMA weeks, 1-2-3-4 weighting)
• Includes signal line (SMA of KST) and visual fill between KST and signal (green/red)
What is the Long-term KST used for?
The KST (Know Sure Thing) is a momentum oscillator created by Martin Pring to detect major trend changes, confirm the primary trend direction, and identify significant reversals in medium- to long-term cycles (weeks to months).
Main practical uses:
• Major trend reversals: KST crossing above/below signal line
• Primary trend confirmation: KST above/below zero line
• Classic divergences: Price vs KST divergences often precede important tops/bottoms
• Cycle identification: Helps spot the end of multi-month corrections or the start of new bull/bear phases
• Trend-following filter: Stay long when KST > 0 and rising, stay short when KST < 0 and falling
It is especially powerful on major indices (FTSE MIB, DAX, SPX, NDX, RUT, CAC40, Nikkei…) because it captures institutional money flow with fewer, higher-quality signals compared to faster oscillators.
Best used on:
• Daily, 4H, Weekly charts
• European indices (FTSE MIB, DAX, IBEX…)
• US indices/ETFs (SPX, NDX, RUT…)
• Crypto pairs (set week_length=7, session_duration=24h)
Enjoy trading the big-picture momentum!
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。