OPEN-SOURCE SCRIPT
Angular Resistance & Breakout/Breakdown

Angular Resistance & Breakout/Breakdown (Dynamic Trendlines)
This indicator provides a dynamic approach to identifying major support and resistance levels by fitting Linear Regression lines to recent pivot points (swing highs and swing lows). Unlike static horizontal lines, these "Angular" trendlines adapt to the market's slope, providing continuously adjusting targets for resistance and support, along with signals for confirmed breakouts and breakdowns.
💡 Key Features
Dynamic Trendlines: Utilizes Linear Regression to automatically draw sloped trendlines based on a configurable number of the most recent swing pivots.
Confirmed Signals: Generates clear Breakout (▲) and Breakdown (▼) signals with optional buffer and sensitivity filters to reduce noise.
Customizable Inputs: Fine-tune the pivot detection period, the number of points used for regression, line extension, and signal sensitivity.
On-Chart Info Panel: A table displays real-time data, including the number of detected pivot points and the current calculated price level of the dynamic lines.
⚙️ How It Works (The Logic)
Pivot Detection: The script uses the standard ta.pivothigh() and ta.pivotlow() functions to reliably identify swing points, based on the Pivot Left and Pivot Right settings. These points are stored in dynamic arrays (highs for resistance, lows for support).
Angular Line Generation: A custom function, f_regression_from_array, performs a Linear Regression analysis using the bar index (X-axis) and the pivot price (Y-axis) for the Points to use. This calculation determines the optimal slope and intercept to draw a best-fit dynamic line through the identified pivot points.
Breakout/Breakdown Confirmation:
Breakout: Triggered when the current close price crosses above the dynamic resistance line plus the user-defined Breakout buffer.
Breakdown: Triggered when the current close price crosses below the dynamic support line minus the user-defined Breakout buffer.
Sensitivity Filter: An optional filter requires the price movement on the signal bar to exceed a minimum percentage (Label sensitivity) away from the line to confirm the momentum of the move.
This indicator provides a dynamic approach to identifying major support and resistance levels by fitting Linear Regression lines to recent pivot points (swing highs and swing lows). Unlike static horizontal lines, these "Angular" trendlines adapt to the market's slope, providing continuously adjusting targets for resistance and support, along with signals for confirmed breakouts and breakdowns.
💡 Key Features
Dynamic Trendlines: Utilizes Linear Regression to automatically draw sloped trendlines based on a configurable number of the most recent swing pivots.
Confirmed Signals: Generates clear Breakout (▲) and Breakdown (▼) signals with optional buffer and sensitivity filters to reduce noise.
Customizable Inputs: Fine-tune the pivot detection period, the number of points used for regression, line extension, and signal sensitivity.
On-Chart Info Panel: A table displays real-time data, including the number of detected pivot points and the current calculated price level of the dynamic lines.
⚙️ How It Works (The Logic)
Pivot Detection: The script uses the standard ta.pivothigh() and ta.pivotlow() functions to reliably identify swing points, based on the Pivot Left and Pivot Right settings. These points are stored in dynamic arrays (highs for resistance, lows for support).
Angular Line Generation: A custom function, f_regression_from_array, performs a Linear Regression analysis using the bar index (X-axis) and the pivot price (Y-axis) for the Points to use. This calculation determines the optimal slope and intercept to draw a best-fit dynamic line through the identified pivot points.
Breakout/Breakdown Confirmation:
Breakout: Triggered when the current close price crosses above the dynamic resistance line plus the user-defined Breakout buffer.
Breakdown: Triggered when the current close price crosses below the dynamic support line minus the user-defined Breakout buffer.
Sensitivity Filter: An optional filter requires the price movement on the signal bar to exceed a minimum percentage (Label sensitivity) away from the line to confirm the momentum of the move.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.
Skrip open-source
Dengan semangat TradingView yang sesungguhnya, pembuat skrip ini telah menjadikannya sebagai sumber terbuka, sehingga para trader dapat meninjau dan memverifikasi fungsinya. Salut untuk penulisnya! Meskipun Anda dapat menggunakannya secara gratis, perlu diingat bahwa penerbitan ulang kode ini tunduk pada Tata Tertib kami.
Pernyataan Penyangkalan
Informasi dan publikasi ini tidak dimaksudkan, dan bukan merupakan, saran atau rekomendasi keuangan, investasi, trading, atau jenis lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Ketentuan Penggunaan.