OPEN-SOURCE SCRIPT

Directional Movement Index - DMI

63
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.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.