OPEN-SOURCE SCRIPT
Trend Quality Score (TQS)

Trend Quality Score (TQS) is a composite indicator designed to evaluate the strength, direction, and consistency of a trend in a single normalized signal.
The indicator combines three core components derived from price action and directional movement:
These components are weighted and combined into a single score (TQS), which fluctuates around zero:
A configurable moving average can be applied to TQS to help identify shifts in trend quality and improve signal clarity.
Key Features
How to Use
Use TQS above zero to confirm bullish conditions and below zero for bearish conditions
Look for crossovers between TQS and its moving average as potential shifts in trend quality
Avoid trading when TQS is near zero, as this indicates low-quality or sideways markets
This indicator is designed as a confirmation and filtering tool and works best when combined with a broader trading strategy.
The indicator combines three core components derived from price action and directional movement:
- Directional Strength – Measures the relative dominance of buyers vs. sellers using the difference between +DI and -DI.
- Trend Strength (DX) – Captures the magnitude of directional movement, smoothed to reduce noise.
- Trend Persistence – Evaluates how consistently price has been moving in one direction over a defined lookback period.
These components are weighted and combined into a single score (TQS), which fluctuates around zero:
- Positive values indicate upward trend conditions
- Negative values indicate downward trend conditions
- Values near zero suggest weak or non-trending markets
A configurable moving average can be applied to TQS to help identify shifts in trend quality and improve signal clarity.
Key Features
- Combines strength, direction, and persistence into one metric
- Helps distinguish strong trends from choppy conditions
- Customizable smoothing and moving average type (SMA, EMA, WMA, RMA)
- Suitable for trend confirmation, filtering trades, or regime detection
How to Use
Use TQS above zero to confirm bullish conditions and below zero for bearish conditions
Look for crossovers between TQS and its moving average as potential shifts in trend quality
Avoid trading when TQS is near zero, as this indicates low-quality or sideways markets
This indicator is designed as a confirmation and filtering tool and works best when combined with a broader trading strategy.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat TradingView sebenar, pencipta skrip ini telah menjadikannya sumber terbuka, jadi pedagang boleh menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupuan anda boleh menggunakan secara percuma, ingat bahawa penerbitan semula kod ini tertakluk kepada Peraturan Dalaman.
Penafian
Maklumat dan penerbitan adalah tidak bertujuan, dan tidak membentuk, nasihat atau cadangan kewangan, pelaburan, dagangan atau jenis lain yang diberikan atau disahkan oleh TradingView. Baca lebih dalam Terma Penggunaan.