OPEN-SOURCE SCRIPT
KST Cross Switch

The Know Sure Thing (KST) oscillator is a powerful momentum indicator, but its constantly fluctuating lines can sometimes make it difficult to determine the definitive market state at a glance.
This script transforms the traditional KST indicator into a clean, 3-stage State Machine tracker. Instead of staring at curved lines, this indicator locks the current market condition into three absolute levels: 100 for Bullish, 0 for Bearish, and 50 for Neutral.
When a strong bullish crossover occurs, the indicator locks to 100 with a lime green background. When a bearish crossunder happens, it locks to 0 with a maroon red background.
The core feature of this script is the Neutral Zone Threshold. In choppy or consolidating markets, KST lines often cross back and forth repeatedly, causing false signals. To solve this, the script checks the absolute distance between the KST line and the Signal line. If they are too close and moving sideways within your defined threshold, the indicator automatically resets to 50 with a neutral yellow/grey background. This helps you avoid overtrading during low-volatility squeeze periods.
You can fully customize the four different Rate of Change (ROC) lengths and their moving averages, as well as the signal line length. The Neutral Zone Threshold can also be finely tuned depending on the asset and timeframe you are trading.
This script transforms the traditional KST indicator into a clean, 3-stage State Machine tracker. Instead of staring at curved lines, this indicator locks the current market condition into three absolute levels: 100 for Bullish, 0 for Bearish, and 50 for Neutral.
When a strong bullish crossover occurs, the indicator locks to 100 with a lime green background. When a bearish crossunder happens, it locks to 0 with a maroon red background.
The core feature of this script is the Neutral Zone Threshold. In choppy or consolidating markets, KST lines often cross back and forth repeatedly, causing false signals. To solve this, the script checks the absolute distance between the KST line and the Signal line. If they are too close and moving sideways within your defined threshold, the indicator automatically resets to 50 with a neutral yellow/grey background. This helps you avoid overtrading during low-volatility squeeze periods.
You can fully customize the four different Rate of Change (ROC) lengths and their moving averages, as well as the signal line length. The Neutral Zone Threshold can also be finely tuned depending on the asset and timeframe you are trading.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.