PROTECTED SOURCE SCRIPT
B Trend Analysis % (No Repaint)

Overview
B Trend Analysis % is a no-repaint indicator that identifies bullish, bearish, or mean-reverting market phases using confirmed (prior-bar) signals from SMA crossovers, ADX trend strength, Supertrend direction, and optional RSI filtering. It visualizes trends via background colors (green for bullish, red for bearish, gray for mean-reversion) and provides a stats table showing bullish/bearish percentages over the chart's history.
How It Works
- SMA Crossover: Detects momentum shifts with short (default 1) vs. long (default 3) SMAs.
ADX Filter: Ensures strong trends (smoothed ADX > threshold, default 1).
Supertrend: Confirms direction using ATR-based bands (period 3, factor 0.3).
RSI (Optional): Filters extremes (oversold >30 for bull, overbought <70 for bear; period 2).
Trends require trendLookback (default 3) consecutive confirmed bars for reliability. Stats count only confirmed bars to avoid repainting.
Usage
- Apply to any timeframe/symbol for trend confirmation.
- Green background: Enter/hold longs; red: shorts; gray: Avoid trades (range-bound).
- Tune inputs: Shorten lengths for scalping; enable RSI for mean-reversion filters.
- Plots: Blue (short SMA), red (long SMA). Table shows % bullish/bearish and ADX strength.
- Best for volatile assets like crypto/forex; back test on clean price charts.
Key Features
- No repainting: Uses [code]var[/code] state and prior-bar values ([code][1][/code]).
- Efficient: Lightweight calcs, no [code]request .security()[/code].
- Customizable: Advanced group for lookback (1-5 bars).
Protected Script Notice
This script is published as Protected to safeguard proprietary elements in the trend confirmation logic, including the custom consecutive-bar counter and smoothed ADX integration, which were developed through extensive back testing. While the core inputs and outputs are fully accessible for use, the exact implementation details are not viewable to prevent unauthorized replication. Users can still apply it to charts, customize visible parameters, and benefit from its no-repaint reliability. For collaboration or access requests, contact the author via Trading View messaging.
This is an original combination for clearer trend stats—fork and improve where possible!
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.
Mã được bảo vệ
Tập lệnh này được đăng dưới dạng mã nguồn đóng. Tuy nhiên, bạn có thể tự do sử dụng tập lệnh mà không có bất kỳ hạn chế nào – tìm hiểu thêm tại đây.
Thông báo miễn trừ trách nhiệm
Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.