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 автор этого скрипта опубликовал его с открытым исходным кодом, чтобы трейдеры могли понять, как он работает, и проверить на практике. Вы можете воспользоваться им бесплатно, но повторное использование этого кода в публикации регулируется Правилами поведения.
Отказ от ответственности
Все виды контента, которые вы можете увидеть на TradingView, не являются финансовыми, инвестиционными, торговыми или любыми другими рекомендациями. Мы не предоставляем советы по покупке и продаже активов. Подробнее — в Условиях использования TradingView.