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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.