Calculation and confirmation guide

Trend strength indicators measure different properties

Trend strength has no single formula. ADX summarizes directional movement imbalance without a bullish or bearish sign. TradingView Trend Strength Index measures correlation between closes and bar order. True Strength Index measures smoothed signed price changes. Bollinger BandWidth measures relative price dispersion. Their scales and thresholds are not interchangeable.

Explore custom indicator coding

Compare the calculation, scale and missing inference

Use the full indicator name and its implementation before applying a threshold.

MeasureCalculation or scaleWhat it does not establish
ADXSmoothed DX, conventionally 0–100; direction comes separately from +DI/-DIWhether price is rising, a profitable entry or an imminent top
Trend Strength IndexCorrelation of closes with bar index, −1 to +1The size of a move, its future persistence or the double-smoothed TSI formula
True Strength IndexDouble-smoothed price change divided by double-smoothed absolute change; often displayed ×100Interchangeability with the correlation-based indicator; check whether code returns raw or percent-scaled output
Bollinger BandWidth100 × (upper − lower) / basis in the percent conventionDirection or whether a volatile path is a steady trend

ADX: one imbalance value can describe opposite directions

For invented +DI = 30 and −DI = 10, DX = 100 × |30 − 10| / (30 + 10) = 50. Swapping the DI values still gives DX 50. ADX smooths a sequence of DX values, so one DX of 50 does not imply an ADX of 50.

  • TradingView describes 20 and 25 as conventional interpretive levels associated with Wilder. They are not universal statistical cutoffs.
  • An ADX of 30 with +DI below −DI can accompany downward movement. A falling ADX does not, by itself, say price reversed upward.
  • An ADX above 40 does not establish exhaustion or quantify the chance of a reversal.
  • If a hand calculation has +DI + −DI equal to zero, specify handling instead of dividing by zero. The example below delegates DMI calculation to ta.dmi and hides unavailable output.

Two useful counterexamples

For closes 100, 101, 102, 103 against bar indices 0, 1, 2, 3, correlation is +1. Closes 100, 110, 120, 130 also have correlation +1 despite ten times the per-bar price change. Correlation measures linear consistency, not price speed.

  • Reversing the first sequence gives correlation −1. A constant close sequence has zero variance, so correlation is undefined rather than automatically zero.
  • Bands at 110 and 90 around a basis of 100 have percent BandWidth 20%. Their width alone says nothing about whether the latest close rose or fell.
  • A large alternating up/down sequence can have high volatility with little steady direction. Adding a volatility filter is not the same as adding independent trend evidence.

Pine Script v6: ADX threshold and separate DI direction

This is an indicator, not an order-executing strategy. It plots all three DMI outputs on completed chart bars. The threshold defaults to 25 as a configurable example. Equal DI values remain direction-neutral; unavailable or developing bars are hidden.

Confirmed DMI values without trade orderspinescript
//@version=6
indicator("Confirmed DMI Strength [Pineify]", overlay=false)
int diLength = input.int(14, "DI length", minval=1)
int adxLength = input.int(14, "ADX smoothing", minval=1)
float threshold = input.float(25.0, "ADX threshold", minval=0.0, maxval=100.0)
[diPlus, diMinus, adxValue] = ta.dmi(diLength, adxLength)
bool available = not na(diPlus) and not na(diMinus) and not na(adxValue)
bool confirmed = available and barstate.isconfirmed
int direction = diPlus > diMinus ? 1 : diMinus > diPlus ? -1 : 0
bool strong = adxValue >= threshold
color stateColor = not strong or direction == 0 ? color.gray : direction == 1 ? color.teal : color.orange
plot(confirmed ? adxValue : na, "ADX", color=stateColor, linewidth=2, style=plot.style_linebr)
plot(confirmed ? diPlus : na, "+DI", color=color.teal, style=plot.style_linebr)
plot(confirmed ? diMinus : na, "-DI", color=color.orange, style=plot.style_linebr)
hline(threshold, "Chosen ADX threshold", color=color.gray, linestyle=hline.style_dashed)
bgcolor(confirmed and strong and direction != 0 ? color.new(stateColor, 92) : na)

Evaluate whether a strength filter helps your actual rule

Keep the underlying entry and exit specification fixed, then compare it with and without the chosen filter. Use the same data, position size, fills and costs. A filter can remove losing trades and winning trades.

  • Report the number of retained trades, exposure, losses, costs and results on an untouched later period. A smaller sample can make an attractive estimate less reliable.
  • Inspect the start of trends and late reversals because smoothing delays changes. Do not label every high reading a continuation signal.
  • Check the current bar through its close. This code suppresses developing-bar values, but chart confirmation does not protect against every feed or history revision.
Where Pineify fits

Pine Script AI Coding Agent

Adapt the stated calculation, inputs and confirmation rule into a Pine Script draft, then inspect the result on your chart.

Explore custom indicator coding

Frequently asked questions

Educational examples, not investment advice or tested trading strategies. Indicators describe supplied historical and developing prices. Syntax validation does not establish profitability or live execution.

Sources and verification