OPEN-SOURCE SCRIPT
已更新 Trend Scanner Pro

Trend Scanner Pro, Robust Trend Direction and Strength Estimator
Trend Scanner Pro is designed to evaluate the current market trend with maximum robustness, providing both direction and strength based on statistically reliable data.
This indicator builds upon the core logic of a previous script I developed, called Best SMA Finder. While the original script focused on identifying the most profitable SMA length based on backtested trade performance, Trend Scanner Pro takes that foundation further to serve a different purpose: analyzing and quantifying the actual trend state in real time.
It begins by testing hundreds of SMA lengths, from 10 to 1000 periods. Each one is scored using a custom robustness formula that combines profit factor, number of trades, and win rate. Only SMAs with a sufficient number of trades are retained, ensuring statistical validity and avoiding curve fitting.
The SMA with the highest robustness score is selected as the dynamic reference point. The script then calculates how far the price deviates from it using rolling standard deviation, assigning a trend strength score from -5 (strong bearish) to +5 (strong bullish), with 0 as neutral.
Two detection modes are available:
Optional features:
This tool is intended for traders who want an adaptive, objective, and statistically grounded assessment of market trend conditions.
Trend Scanner Pro is designed to evaluate the current market trend with maximum robustness, providing both direction and strength based on statistically reliable data.
This indicator builds upon the core logic of a previous script I developed, called Best SMA Finder. While the original script focused on identifying the most profitable SMA length based on backtested trade performance, Trend Scanner Pro takes that foundation further to serve a different purpose: analyzing and quantifying the actual trend state in real time.
It begins by testing hundreds of SMA lengths, from 10 to 1000 periods. Each one is scored using a custom robustness formula that combines profit factor, number of trades, and win rate. Only SMAs with a sufficient number of trades are retained, ensuring statistical validity and avoiding curve fitting.
The SMA with the highest robustness score is selected as the dynamic reference point. The script then calculates how far the price deviates from it using rolling standard deviation, assigning a trend strength score from -5 (strong bearish) to +5 (strong bullish), with 0 as neutral.
Two detection modes are available:
- Slope mode, based on SMA slope reversals
- Bias mode, based on directional shifts relative to deviation zones
Optional features:
- Deviation bands for visual structure
- Candle coloring to reflect trend strength
- Compact table showing real-time trend status
This tool is intended for traders who want an adaptive, objective, and statistically grounded assessment of market trend conditions.
發行說明
Minor update: added user-defined color inputs for trend bias (bullish, bearish, neutral).開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
The trend is your friend, until it's not...
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
The trend is your friend, until it's not...
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。