PROTECTED SOURCE SCRIPT
Smart Breakout Detector: Trendline Retest & Angle Filtering

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
═══════════════════════════════════════════
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
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, özgürce ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgi burada.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Korumalı komut dosyası
Bu komut dosyası kapalı kaynak olarak yayınlanmaktadır. Ancak, özgürce ve herhangi bir sınırlama olmaksızın kullanabilirsiniz – daha fazla bilgi burada.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.