OPEN-SOURCE SCRIPT
Trend Score For Loop | NickJoan

Trend Score For Loop is a trend-classification indicator that evaluates the current source relative to a defined range of prior bars using a loop-based scoring process. The resulting score is compared against user-defined threshold levels to identify bullish and bearish state shifts, while the indicator simultaneously colors price candles to reflect the active directional bias.
Methodology
The indicator calculates a cumulative score by comparing the current source value to each historical value between the selected Start and End lookback points. A positive comparison contributes to upward bias, while a negative comparison contributes to downward bias, producing a simple but adaptive measure of directional strength across the selected range.
Signal logic
A bullish state is established when the score exceeds the Long Threshold, while a bearish state is established when the score falls below the Short Threshold. Once a state is confirmed, it remains active until an opposing threshold condition is triggered, allowing the indicator to behave as a persistent market-bias filter.
Visual output
The script plots the trend score in a separate pane and applies color-coded candle overlays on the main chart to improve visual interpretation of the active state.
Methodology
The indicator calculates a cumulative score by comparing the current source value to each historical value between the selected Start and End lookback points. A positive comparison contributes to upward bias, while a negative comparison contributes to downward bias, producing a simple but adaptive measure of directional strength across the selected range.
Signal logic
A bullish state is established when the score exceeds the Long Threshold, while a bearish state is established when the score falls below the Short Threshold. Once a state is confirmed, it remains active until an opposing threshold condition is triggered, allowing the indicator to behave as a persistent market-bias filter.
Visual output
The script plots the trend score in a separate pane and applies color-coded candle overlays on the main chart to improve visual interpretation of the active state.
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.