TrendPine Script v6

ta.dmi()

Directional Movement Index

The dmi function returns the directional movement index.

Syntax

Syntax
ta.dmi(diLength, adxSmoothing) → [series float, series float, series float]

Arguments

ParameterTypeDescription
diLengthsimple intDI period.
adxSmoothingsimple intADX smoothing period.

Returns

Tuple of three DMI series: Positive Directional Movement (+DI), Negative Directional Movement (-DI) and Average Directional Movement Index (ADX).

Code Examples

Pine Script v6 Example
//@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

Related Functions

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.