OPEN-SOURCE SCRIPT
Directional Movement Index - DMI

This Pine Script is a Directional Movement Index (DMI) indicator for TradingView that provides a comprehensive visualization of trend direction and strength with several enhanced visual features.
📊 Core Indicator Components:
1. Directional Indicators:
+DI (Green line): Measures upward trend momentum
-DI (Red line): Measures downward trend momentum
ADX (Blue line, optional): Measures overall trend strength (can be toggled on/off)
2. Key Calculations:
Uses built-in ta.dmi() function to calculate all three components
isBull condition: Determines current bias based on which DI line is higher
Bull signal: When +DI crosses above -DI
Bear signal: When +DI crosses below -DI
🎨 Visual Design Features:
1. Chart Plotting:
Thick lines (width=3) for +DI and -DI for better visibility
Color-coded plots: Green (+DI), Red (-DI), Blue (ADX)
2. Background Highlighting:
Light green background on bullish crossovers
Light red background on bearish crossovers
Uses 60% transparency for subtle visual cues
3. Real-time Status Panel:
Fixed table in the middle-right of the chart
Displays "↑ Bullish" (green) or "↓ Bearish" (red) in huge text
Updates on every bar to show current market bias
4. Line Labels:
Text labels at the right edge identifying each line
Color-matched to their respective indicators
ADX label only appears when ADX is enabled
⚙️ User Controls:
ADX toggle: Show/hide the ADX line
DI Length: Adjust calculation period (default 17)
ADX Smoothing: Fine-tune ADX smoothing (default 1)
📈 Trading Application:
Trend Identification: Which direction has stronger momentum
Signal Generation: Crossovers indicate potential trend changes
Trend Strength: ADX (when shown) indicates if a trend is strong (>25) or weak
Visual Clarity: Multiple visual cues make signals easy to spot
🖥️ Display Logic:
The script intelligently handles what to display based on user settings
When ADX is disabled, it plots na (not available) to avoid scale distortion
All visual elements update dynamically with each new bar
🎯 Unique Aspects:
Multi-layered visualization: Combines lines, background colors, labels, and a status table
Clean separation: Uses box-drawing characters to organize code sections
Right-edge labeling: Makes indicator identification clear even on crowded charts
Immediate bias recognition: The large text table provides instant market bias assessment
This indicator is particularly useful for traders who want a clear, visually rich representation of trend direction without needing to interpret multiple lines simultaneously. The color-coded background and status panel provide quick visual confirmation of market conditions.
📊 Core Indicator Components:
1. Directional Indicators:
+DI (Green line): Measures upward trend momentum
-DI (Red line): Measures downward trend momentum
ADX (Blue line, optional): Measures overall trend strength (can be toggled on/off)
2. Key Calculations:
Uses built-in ta.dmi() function to calculate all three components
isBull condition: Determines current bias based on which DI line is higher
Bull signal: When +DI crosses above -DI
Bear signal: When +DI crosses below -DI
🎨 Visual Design Features:
1. Chart Plotting:
Thick lines (width=3) for +DI and -DI for better visibility
Color-coded plots: Green (+DI), Red (-DI), Blue (ADX)
2. Background Highlighting:
Light green background on bullish crossovers
Light red background on bearish crossovers
Uses 60% transparency for subtle visual cues
3. Real-time Status Panel:
Fixed table in the middle-right of the chart
Displays "↑ Bullish" (green) or "↓ Bearish" (red) in huge text
Updates on every bar to show current market bias
4. Line Labels:
Text labels at the right edge identifying each line
Color-matched to their respective indicators
ADX label only appears when ADX is enabled
⚙️ User Controls:
ADX toggle: Show/hide the ADX line
DI Length: Adjust calculation period (default 17)
ADX Smoothing: Fine-tune ADX smoothing (default 1)
📈 Trading Application:
Trend Identification: Which direction has stronger momentum
Signal Generation: Crossovers indicate potential trend changes
Trend Strength: ADX (when shown) indicates if a trend is strong (>25) or weak
Visual Clarity: Multiple visual cues make signals easy to spot
🖥️ Display Logic:
The script intelligently handles what to display based on user settings
When ADX is disabled, it plots na (not available) to avoid scale distortion
All visual elements update dynamically with each new bar
🎯 Unique Aspects:
Multi-layered visualization: Combines lines, background colors, labels, and a status table
Clean separation: Uses box-drawing characters to organize code sections
Right-edge labeling: Makes indicator identification clear even on crowded charts
Immediate bias recognition: The large text table provides instant market bias assessment
This indicator is particularly useful for traders who want a clear, visually rich representation of trend direction without needing to interpret multiple lines simultaneously. The color-coded background and status panel provide quick visual confirmation of market conditions.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。