OPEN-SOURCE SCRIPT
Marcius Studio® - Trend Detector™

Trend Detector™ — is an advanced trend detection indicator that combines statistical Z-Score analysis with a simplified ADF stationarity test.
It is designed to help traders identify strong directional moves while filtering out noise and false signals.
Unlike traditional moving average crossovers or momentum oscillators, this tool evaluates both trend direction and trend strength, giving you a clear visual overview of market conditions.
Idea
Markets spend 70–80% of the time in consolidation and only 20–30% in trending phases. The key to profitable trading is spotting when a major trend shift begins. Trend Detector™ was built exactly for this purpose — to filter noise and highlight true trend reversals.
How It Works
Features
Recommendations
Indicator Settings
Example Settings
Disclaimer
Trading and investing involve risk — always do your own research (DYOR) and seek professional advice. We are not responsible for any financial losses.
It is designed to help traders identify strong directional moves while filtering out noise and false signals.
Unlike traditional moving average crossovers or momentum oscillators, this tool evaluates both trend direction and trend strength, giving you a clear visual overview of market conditions.
Important! This indicator is intended for educational and informational purposes. It does not guarantee future performance and should be used together with proper risk management.
Idea
Markets spend 70–80% of the time in consolidation and only 20–30% in trending phases. The key to profitable trading is spotting when a major trend shift begins. Trend Detector™ was built exactly for this purpose — to filter noise and highlight true trend reversals.
How It Works
- Calculates the Z-Score of price to detect extreme deviations from the mean.
- Applies a simplified ADF t-Statistic test to confirm trend validity.
- Uses an ATR-based ribbon for clean visualization of bullish/bearish phases.
- Generates Buy/Sell signals when trend switches are confirmed.
- Displays an Info Panel with real-time metrics: Z-Score, ADF t-Stat, Trend Strength (0–100), ATR % of price.
Features
- Trend Ribbon: visually highlights bullish, bearish, or neutral phases.
- Confirmation Filter: avoids false flips by requiring multiple bars of validation.
- Strength Score: quantifies how powerful the current trend is.
- Signal Markers: “BUY” and “SELL” alerts appear directly on the chart.
- Customizable Alerts: get notified when new uptrends or downtrends are detected.
Recommendations
- Works well on swing trading timeframes (1H, 4H, Daily).
- Use in combination with support/resistance zones or volume profile tools for higher accuracy.
- The higher the Trend Strength Score, the more reliable the trend continuation.
Indicator Settings
- Analysis Period: number of bars for Z-Score & ADF test.
- ATR Length: used for ribbon visualization.
- Min Bars to Confirm Trend: filters false trend flips.
- Show/Hide options for Ribbon, Signals, and Info Panel.
Example Settings
- Timeframe: 1H or 4H
- Analysis Period: 20
- ATR Length: 14
- Min Confirmation Bars: 2–3
Disclaimer
Trading and investing involve risk — always do your own research (DYOR) and seek professional advice. We are not responsible for any financial losses.
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.
Need a custom TradingView bot, indicator, strategy? We'll develop a solution tailored to your needs. Build your idea at studio.marcius.com
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.
Need a custom TradingView bot, indicator, strategy? We'll develop a solution tailored to your needs. Build your idea at studio.marcius.com
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.