Trend

DMI Signals: Directional Spread and Repeated Crosses

Inspect +DI/-DI ordering, ADX filters and repeated crosses with a Pine Script example. Separate directional spread from forecasts of trend speed or exhaustion.

DMI Signal Interpretation

Quick-reference guide to 5 signal types you will see on the chart.

Signal TypeIndicator ConditionMarket MeaningInterpretation limits
Positive DI cross+DI crosses above -DI with ADX above the configured filterAn upward change in directional-index ordering.Not a guarantee of a new price trend.
Negative DI cross-DI crosses above +DI with the same ADX filterA downward change in directional-index ordering.The strength threshold cannot eliminate false events.
Signed DI spread+DI minus -DIPositive means +DI dominates; negative means -DI dominates.Magnitude is not price velocity or a measured return forecast.
Repeated crosses in the observation windowAt least three DI crosses within the configured window, with current ADX below the thresholdA precisely defined count and current-state filter.This is not proof all bars were low-ADX or that the next trade fails.
Falling ADX after a high readingADX declines from a prior levelA decline in smoothed strength.No fixed reversal delay or exhaustion trade is implemented.

DMI Pine Script Signal Code

Educational indicator example. Review its exact rules and compare its plots with your intended calculation in TradingView. It does not place orders or establish profitability.

Pine Script v6
//@version=6
indicator("DMI Spread and Cross Count Examples", overlay=false)
diLength = input.int(14, "DI Length", minval=1)
adxLength = input.int(14, "ADX Smoothing", minval=1)
threshold = input.float(25, "ADX Threshold", minval=0, maxval=100)
window = input.int(10, "Cross Count Window", minval=3)
showMarkers = input.bool(true, "Show Markers")
[plus, minus, adx] = ta.dmi(diLength, adxLength)
upCross = ta.crossover(plus, minus)
downCross = ta.crossunder(plus, minus)
spread = plus - minus
crossCount = math.sum(upCross or downCross ? 1.0 : 0.0, window)
bullish = barstate.isconfirmed and upCross and adx > threshold
bearish = barstate.isconfirmed and downCross and adx > threshold
repeatedState = crossCount >= 3 and adx < threshold
repeatedEntry = barstate.isconfirmed and repeatedState and not repeatedState[1]
plot(plus, "+DI", color=color.green)
plot(minus, "-DI", color=color.red)
plot(adx, "ADX", color=color.purple)
plot(spread, "Signed DI spread", color=color.gray, display=display.data_window)
plot(crossCount, "Crosses in window", display=display.data_window)
hline(threshold, "Selected ADX threshold", color=color.gray)
plotshape(showMarkers and bullish, "Positive DI cross", shape.triangleup, location.bottom, color=color.green, size=size.small)
plotshape(showMarkers and bearish, "Negative DI cross", shape.triangledown, location.top, color=color.red, size=size.small)
plotshape(showMarkers and repeatedEntry, "Repeated-cross state begins", shape.xcross, location.top, color=color.orange, size=size.tiny)
alertcondition(bullish, "Positive DI cross", "Confirmed positive DI cross with ADX above the selected threshold")
alertcondition(bearish, "Negative DI cross", "Confirmed negative DI cross with ADX above the selected threshold")
alertcondition(repeatedEntry, "Repeated-cross state begins", "At least three DI crosses in the selected window and current ADX below the selected threshold")

Example settings for DMI

Record the inputs used by the example. These settings are not an optimized trading recommendation.

Feature comparison table: Default vs Description
ParameterDefaultDescription
DI Length14, exampleControls directional movement calculations, independently from ADX smoothing.
ADX Smoothing14, exampleChanges smoothing of relative directional imbalance; it does not enforce a predictable lead or lag in price bars.
ADX Threshold25, exampleUsed consistently by crossing filters, the repeated-cross state and the plotted reference line.
Cross Count Window10 bars, exampleCounts both upward and downward DI crosses. The repeated state requires at least three, rather than only two opposite crosses on adjacent bars.
Show MarkersEnabledControls visual markers only. Named alert conditions remain available when markers are hidden.

Turn the condition into an explicit rule

Specify the calculation, confirmation time, entry and exit rules before asking Pineify to draft or revise Pine Script. Review the code and simulate realistic costs before evaluating a strategy.

Explore Pine Script coding

FAQ

DMI Signals FAQ

How does this page differ from an ADX-only guide?
ADX describes strength. Here the focus is the ordering of the two DI lines, their signed spread and an explicit count of repeated crosses. These diagnostics describe different aspects of the same directional-movement calculation.
Can DI spread predict a reversal 5–15 bars early?
No such lead time is established here. Narrowing spread is a change in calculated directional movement, and price can continue or consolidate without reversing.
Does an ADX decline of ten points guarantee exhaustion?
No. A chosen drop rule can be studied, but a high reading followed by a decline does not prove a climax. This example does not emit an exhaustion alert.
Does the volume filter prove institutional participation?
No. Aggregate volume does not identify the participants. Any volume condition must be specified and compared with an otherwise identical baseline before making a performance claim.
How do I evaluate repeated-cross behavior?
Use the Data Window to inspect the cross count and signed spread. Confirm which bars lie inside the rolling window and whether only the current ADX or every bar’s ADX is meant to be filtered. This code uses current ADX only.
Is the example a complete trading strategy?
No. It plots diagnostics and alert events on the chart timeframe. It has no order execution, multi-timeframe request, trade sample or established win rate.