OPEN-SOURCE SCRIPT
Aggiornato 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.
Note di rilascio
Minor update: added user-defined color inputs for trend bias (bullish, bearish, neutral).Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
The trend is your friend, until it's not...
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
The trend is your friend, until it's not...
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.