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.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.