Docs

ta.dmi

Measure trend direction and strength with directional indicators and their average.

itm
ta.dmi(diLength, adxSmoothing, bars)

Directional Movement: [positive indicator, negative indicator, average directional index]. The positive move is high - high[1] when that move exceeds both low[1] - low and zero, else 0. The negative move mirrors it. Each is smoothed with Wilder's moving average over diLength, divided by the same smoothing of ta.tr and scaled by 100. The average directional index is Wilder's moving average over adxSmoothing of 100*abs(plus - minus)/(plus + minus), taken as 0 when both are 0. Bars are read from bars.

Parameters

A series parameter takes a value on every bar. A constant parameter must be known before the first bar, such as a number or an input.

NameKindTypeUnitDefaultRangeDescription
diLengthConstantnumber-141 to 10000Window for the directional movement and the true range.
adxSmoothingConstantnumber-141 to 10000Window the directional index is smoothed over.
barsConstantbarsbarsna-Which bars to read: a declared series, or na for the chart's own.

Outputs

NameTypeUnit
diplusnumber-
diminusnumber-
adxnumber-

The outputs come back in this order: [diplus, diminus, adx] = ta.dmi(…).

Warm-up and missing values

Warm-up
diLength + adxSmoothing bars. Names in the warm-up are this operator’s parameters.
Missing values
The two indicators are na until the directional movement and the true range have both warmed up over diLength. The average directional index is na until its own smoothing has warmed up on top of that. na when the smoothed true range is zero.

Example

itm
[diPlus, diMinus, adx] = ta.dmi(14, 14)
itm
[diPlus, diMinus, adx] = ta.dmi(14, 14)
plot(adx, "Trend strength")