Indicator library · Regime

Trend Intensity Index

How consistently, and by how much, price has stayed on one side of a longer average. A persistence measure built from the most ordinary component in technical analysis, and one that keeps the direction ADX throws away.

The calculation

  1. Compute a longer moving average of the close, conventionally 60 periods.
  2. For each bar, take the deviation of the close from that average.
  3. Over a shorter window — conventionally 30 — sum the positive deviations and the negative ones separately, then: TII = positive ÷ (positive + negative) × 100.

The output is bounded 0 to 100 because it is a share of a total. It reads 100 when every close in the window sat above the average, 0 when every one sat below, and 50 when the deviations balanced out. Note what is being weighted: not the number of closes above the line but the distance, so thirty closes barely above the average produce a lower reading than thirty closes far above it.

The index through an advance, a range and a declineThe upper panel shows a price series advancing for about twenty bars, moving sideways for ten, then declining for fifteen. The lower panel shows the trend intensity index on a nought-to-one-hundred scale, high through the advance, falling towards the middle during the sideways stretch, and low through the decline.CLOSE805020TII 20/100.00rangeThe index through an advance, a range and a declineThe upper panel shows a price series advancing for about twenty bars, moving sideways for ten, then declining for fifteen. The lower panel shows the trend intensity index on a nought-to-one-hundred scale, high through the advance, falling towards the middle during the sideways stretch, and low through the decline.CLOSE805020TII 20/100.00range
Fig. 1: schematicComputed at build time with a 20-bar average and a 10-bar window, shortened from 60/30 so the shape fits forty-five bars. It reaches 100 in the advance and 0 in the decline, and reads 37.55 in the sideways stretch between them. That middle reading is the useful part: the index is not saying the market is weak, it is saying the closes have been landing on both sides of the average, which is what "no trend" looks like when it is measured rather than eyeballed.

Three ways to ask one question

This library now contains three measures of whether a market is trending, and they are worth laying beside one another, partly because each has a different weakness, and partly because it is tempting to read agreement between them as confirmation when all three are functions of the same closing prices.

Regime measures compared
MeasureReadsDirection?Main weakness
Trend intensity indexPosition against a longer average, weighted by distanceKept, above 50 is upInherits the reference average's artefacts, including the window exit.
ADXConsistency of directional movement, bar to barDiscardedThree stacked smoothings: late in, late out.
Efficiency ratioNet move divided by the distance travelled, the pathDiscardedUnsmoothed and jumpy; a gap reads as high efficiency.

The genuine advantage of this one is the middle column. A system that wants to take long signals only in an uptrend needs both facts, and ADX supplies only half of them, which is why it is normally read alongside its own DI lines. Here one number carries both.

What it inherits from the average underneath

Every property of the reference average passes through into the index, and one of them is easy to miss. A simple moving average can move sharply on a quiet session because a large value has just left the back of its window, so the deviations, and therefore the index, can shift on a day when price did almost nothing.

Two consequences follow. A reading that changes without a corresponding move in price is worth checking against the average rather than interpreted, and an exponential reference average removes the artefact at the cost of making the index depend on how much history it was fed. Neither choice is wrong; leaving it unstated is what makes two implementations disagree.

Reading the middle of the range

Most oscillator pages here spend their attention on the extremes. This one is more useful in the middle, because a reading near 50 is a positive statement rather than an absence of one: the closes have been landing on both sides of the longer average, which is what a market without a trend looks like when it is measured instead of eyeballed.

That matters for the job the index is best at. A system switched on by a trend measure needs to know when to stand aside, and "the index is at 48" is a cleaner instruction than an eyeballed judgement that the chart looks choppy. The extremes then become the less interesting half of the scale. They confirm what the price chart has already made obvious.

Where it misleads

Known failure modes
SituationWhat goes wrong
Read as a strength measureIt reports persistence of position, not the size of the move. A slow grind far above the average scores highly.
Inherited thresholds80 and 20 depend on the two window lengths. A shorter window reaches both extremes far more often.
Window-exit artefactThe reference average can move on a quiet day, shifting the index with it.
Read as confirmation of ADXBoth are functions of the same closes. Agreement between them is one observation seen twice.
Both windows tuned togetherThe average and the window do different jobs and interact; searching both overfits quickly.
Unadjusted pricesA split puts one enormous deviation into the window and distorts the reading for its whole length.

What volume adds

The index can report a strong, persistent trend without any knowledge of how many participants produced it. A market that has drifted above its 60-day average for thirty sessions on the lightest volume of the year reads exactly like one that got there on heavy, contested participation.

Used as a regime switch (which is its best role), that gap has a practical cost, because the regime it certifies may be the absence of anyone on the other side rather than the presence of demand. Reading the volume beside it is the difference between "this market is trending" and "this market is trending and someone is paying for it".

Frequently asked questions

How is the trend intensity index calculated?

Take the deviation of each close from a longer moving average, conventionally 60 periods. Over a shorter window, conventionally 30, sum the deviations that are positive and, separately, the deviations that are negative. The index is the positive sum divided by the total, as a percentage. A reading of 100 means every close in the window was above the average; 0 means every one was below; 50 means the deviations balanced.

What does it measure that a moving average does not?

How consistently price has stayed on one side of that average, weighted by how far. A single close above a 60-day average says almost nothing; thirty consecutive closes above it, each by a wide margin, is a different statement, and that is what this index puts a number on. It is a persistence measure built out of the most ordinary component in technical analysis.

How is it different from ADX?

ADX measures the consistency of directional movement bar to bar, through three layers of Wilder smoothing, and discards direction with an absolute value. This measures position relative to a longer average and keeps the direction, above 50 means the closes have been predominantly above the average. ADX is later and steadier; this is more direct and noisier. They agree about regimes and disagree about turns, and because both are functions of the same closing prices they are not independent confirmation of each other.

What levels are used?

Above 80 is described as a strong uptrend and below 20 as a strong downtrend, with the band between 20 and 80 treated as no useful trend. Those figures are conventions from M.H. Pee’s original description rather than statistical properties, and they behave differently on different lookback pairs, a shorter window reaches both extremes far more often. Deriving the thresholds from the instrument’s own distribution is the same discipline every other threshold here gets.

Why two windows?

The long average defines what "the trend" is being measured against; the shorter window defines how recent the evidence has to be. They do different jobs and they interact: lengthening the average makes the reference slower to move, while lengthening the window makes the index steadier without changing the reference. Searching both on past data overfits considerably faster than tuning a single period.

Does it lead or lag?

It lags, and less than ADX. There is one moving average inside it and no recursive smoothing on top, so it responds within a few bars of price crossing the average, which is itself a lagging reference. What it cannot do is anticipate: a reading of 90 says the last thirty closes were consistently above a slower average, a statement entirely about what has already happened.

Can it be used as a regime filter?

That is its best use, and it competes directly with ADX and the efficiency ratio for the job. Its advantage over ADX is that it keeps the direction, so one number tells you both whether there is a trend and which way, useful when a system wants to take only long signals in an uptrend. Its disadvantage is that it inherits every property of the average it is measured against, including the window-exit artefact that moves a simple average on a quiet day.

Is it related to the efficiency ratio?

Only in the question it answers. The efficiency ratio divides the net move by the total distance travelled, so it reads the path; this compares closes with a longer average, so it reads position. A market can be highly efficient over ten bars while sitting near its 60-day average, and it can be persistently above that average while zig-zagging inefficiently. Running both is defensible; treating their agreement as confirmation is not, since both are computed from the same closes.