ta.dmi()
Directional Movement Index
The dmi function returns the directional movement index.
Syntax
ta.dmi(diLength, adxSmoothing) → [series float, series float, series float]Arguments
| Parameter | Type | Description |
|---|---|---|
| diLength | simple int | DI period. |
| adxSmoothing | simple int | ADX smoothing period. |
Returns
Tuple of three DMI series: Positive Directional Movement (+DI), Negative Directional Movement (-DI) and Average Directional Movement Index (ADX).
Code Examples
//@version=6
indicator(title="Directional Movement Index", shorttitle="DMI", format=format.price, precision=4)
len = input.int(17, minval=1, title="DI Length")
lensig = input.int(14, title="ADX Smoothing", minval=1)
[diplus, diminus, adx] = ta.dmi(len, lensig)
plot(adx, color=color.red, title="ADX")
plot(diplus, color=color.blue, title="+DI")
plot(diminus, color=color.orange, title="-DI")Trading Applications
Measure trend strength with ADX
Identify trend direction with +DI/-DI crossovers
Filter trades based on ADX threshold
Combine with other indicators for trend confirmation
Frequently Asked Questions
Generate ta.dmi() Code with AI
Skip the manual coding. Use Pineify's AI Coding Agent to generate Pine Script code using ta.dmi() and other built-in functions instantly.
Related Pine Script Functions
ta.macd() - MACD
Learn how to use ta.macd() in Pine Script. Syntax, parameters, code examples for MACD line, signal line, and histogram.
ta.supertrend() - Supertrend
Learn how to use ta.supertrend() in Pine Script. Syntax, parameters, code examples for the ATR-based trend overlay.
ta.sar() - Parabolic SAR
Learn how to use ta.sar() in Pine Script. Syntax, parameters, code examples for the Parabolic Stop and Reverse indicator.
ta.rsi() - Relative Strength Index
Learn how to use ta.rsi() in Pine Script. Syntax, parameters, code examples for the RSI momentum oscillator.
ta.atr() - Average True Range
Learn how to use ta.atr() in Pine Script. Syntax, parameters, code examples for the Average True Range volatility indicator.