PROTECTED SOURCE SCRIPT

Smart Breakout Detector: Trendline Retest & Angle Filtering

34
Detect trendline breakouts with two important filtering controls: retest validation and angle filtering. Require multiple price retests (2-4 touches) before a trendline is considered valid, eliminating weak single-touch lines. Set precise angle limits to filter out unreliable steep or shallow trendlines. Three independent timeframe sets (fast/medium/slow) with customizable pivot lengths allow you to get low risk entry point for both short-term and major trend continuations/reversals.



═══════════════════════════════════════════
CORE METHODOLOGY
═══════════════════════════════════════════

This indicator identifies trendline breakouts using two configurable filtering parameters that are uncommon in publicly available indicators:

1. RETEST VALIDATION
Requires a specified number of price touches (2-4) before considering a trendline valid. This reduces false signals from randomly aligned single-touch lines. Higher thresholds decrease signal frequency while increasing reliability.

2. ANGLE FILTERING
Applies maximum angle constraints (0-20) to trendlines independently for resistance and support, both upward and downward slopes. This filters trendlines with extreme angles that typically lack predictive value.


═══════════════════════════════════════════
TECHNICAL IMPLEMENTATION
═══════════════════════════════════════════

DETECTION ALGORITHM:
1. Identifies pivot highs/lows using configurable lookback periods
2. Connects pivots within ATR-based proximity threshold
3. Validates trendlines only after minimum retest requirement is met
4. Applies angle constraints using arctangent calculations
5. Verifies no price penetration occurred between pivot points
6. Triggers breakout signals when price breaches validated lines

THREE INDEPENDENT TREND LINE BANKS:
The indicator operates three parallel detection systems with separate parameters:

- Level Set A: Short pivot periods (default 5 bars)
- Level Set B: Medium pivot periods (default 10 bars)
- Level Set C: Long pivot periods (default 6 bars)

Each system maintains independent arrays of resistance and support lines.

ADAPTIVE COMPONENTS:
- Proximity tolerance scales with ATR(40) to accommodate volatility
- Angle thresholds adjust using combined absolute and percentage ATR factors
- Line lifespan configurable by bar count (default 180/200/300 bars per set)

══════════════════════════════════════════
USE CASES
══════════════════════════════════════════

Appropriate for:
- Filtering breakout candidates by reliability metrics
- Multi-timeframe trendline analysis
- Automated breakout monitoring
- Reducing chart noise from weak trendlines

Not appropriate for:
- Range-bound or highly choppy markets
- Instruments with insufficient historical data
- Strategies requiring predictive (non-historical) trendlines


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.