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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Need a custom TradingView bot, indicator, strategy? We'll develop a solution tailored to your needs. Build your idea at studio.marcius.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Need a custom TradingView bot, indicator, strategy? We'll develop a solution tailored to your needs. Build your idea at studio.marcius.com
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.