OPEN-SOURCE SCRIPT
KDJ Max-Distance (K-D vs K-J)

This indicator measures the maximum divergence between K and its related lines (D or J) in the KDJ stochastic system.
KEY CONCEPT:
- Calculates two distances: |K-D| and |K-J|
- Outputs whichever distance is larger
- Shows which component (D or J) is most diverged from K at any given time
CALCULATION:
1. Standard KDJ: K (fast), D (K smoothed), J (3K - 2D)
2. Distance K-D: momentum between fast and slow lines
3. Distance K-J: captures extreme divergence
4. Output: max(|K-D|, |K-J|) or signed version
INTERPRETATION:
• High positive values: K strongly above both D and J (strong upward momentum)
• High negative values: K strongly below both D and J (strong downward momentum)
• Near zero: K aligned with D/J (consolidation or reversal zone)
• Background color shows which is dominant: Teal=K-D, Orange=K-J
USE CASES:
- Identify extreme momentum conditions
- Spot divergence exhaustion
- Confirm trend strength
- Filter ranging vs trending markets
SETTINGS:
- Signed mode: preserves direction (positive/negative)
- Absolute mode: shows pure distance magnitude
- Adjustable guide levels for visual reference
KEY CONCEPT:
- Calculates two distances: |K-D| and |K-J|
- Outputs whichever distance is larger
- Shows which component (D or J) is most diverged from K at any given time
CALCULATION:
1. Standard KDJ: K (fast), D (K smoothed), J (3K - 2D)
2. Distance K-D: momentum between fast and slow lines
3. Distance K-J: captures extreme divergence
4. Output: max(|K-D|, |K-J|) or signed version
INTERPRETATION:
• High positive values: K strongly above both D and J (strong upward momentum)
• High negative values: K strongly below both D and J (strong downward momentum)
• Near zero: K aligned with D/J (consolidation or reversal zone)
• Background color shows which is dominant: Teal=K-D, Orange=K-J
USE CASES:
- Identify extreme momentum conditions
- Spot divergence exhaustion
- Confirm trend strength
- Filter ranging vs trending markets
SETTINGS:
- Signed mode: preserves direction (positive/negative)
- Absolute mode: shows pure distance magnitude
- Adjustable guide levels for visual reference
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。