Trend quality
How orderly and strong a trend is, from 0 to 3, with no direction given.
TrendQuality adds three parts, each capped between 0 and 1: EMA alignment (1 when close, EMA 8, 21, 50 and 200 are fully stacked in one order, 0.6 when close, EMA 8 and EMA 21 are stacked, 0.3 when close is only on one side of EMA 8, 0 otherwise), ADX divided by 40, and the gap between +DI and -DI divided by 30. The total runs from 0 to 3. It measures how clean and strong a trend is, not which way it points.
How to read it
- The line sits in its own pane below the price, from 0 (no trend) up to 3 (everything agrees).
- Below 0.5 is weak. Between 0.5 and 1.0 is a moderate trend. Above 1.0 needs EMA alignment or a clear +DI/-DI gap to add to the ADX part.
- It does not give direction. Read the price and the DI lines to know whether the trend is up or down.
What it outputs
- Trend quality
- A 0-to-3 score of how orderly and strong the trend is, summed from EMA alignment, ADX strength and the +DI/-DI gap.
Pitfalls
- The EMA and DI inputs have no default, so the preview feeds the close into all of them. Alignment and DI parts stay 0 and the line is just ADX/40, capped at 1. Wire real EMAs and DI lines.
- The score is direction-blind: a strong downtrend and a strong uptrend both score high.
- The code's own thresholds (above 2.0 is very strong) are not reached in the preview, which only got up to 1.0, so they are untested here.