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.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.