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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。