Trend strength analyzer
A 0 to 10 trend score; a high reading can come from a sharp drop as well as a rally.
It adds three parts into one whole number from 0 to 10: trend alignment, volume and move size. Alignment (0 to 4) checks whether the last close is above the closes 2, 7 and window-minus-one bars back, and scores 4 only when all three are up and the 2-bar change beats the 7-bar change, which beats the long change. Volume (0 to 3) rates the current bar's volume against the window average, and move size (0 to 3) rates the 2-bar change in either direction.
How to read it
- The line sits in its own pane below the price and takes whole numbers from 0 to 10. At the default window of 20, the first 19 bars are blank.
- Alignment adds points only for up-moves, while volume and move size also count drops, so a high reading can come from a sharp selloff on heavy volume.
- On the SPY sample the typical bar scored 1 and the top 5% scored 5 or more, so 5 and up marks an unusual bar.
What it outputs
- Trend score
- Whole-number strength score from 0 to 10, the sum of alignment, volume and move size.
Settings
- window
- Bars in the lookback, which also sets the volume average and the long-term change. Raising it lengthens the blank start and makes the long-term change span more bars. Below 20 the top alignment point never fires, and at 1 or 2 nothing is drawn.
Pitfalls
- Direction is only partly counted: momentum and volume points score a drop like a rally, so a sharp selloff on heavy volume can reach 6 with no alignment points.
- The code comments call the momentum legs 3, 8 and 20 bars, but at the default window they compare the last close with closes 2, 7 and 19 bars back.
- On SPY one-minute bars for September 2026 the median was 1, the 95th percentile 5 and the maximum 7, with correlation to close of 0.01, so the line does not follow price.