OPEN-SOURCE SCRIPT
已更新 Trendlines

Trendline S&R
This indicator is an automated technical analysis tool designed to identify the most relevant Support and Resistance (S&R) zones based on market pivots. Unlike standard pivot indicators that clutter the chart with historic lines, this script uses a "Closest-to-Price" algorithm to display only the single most relevant Support (Green) and Resistance (Red) zone currently interacting with price action.
It solves common frustrations with automated trendlines—specifically the issue of lines disappearing immediately upon a breakout—by introducing a Stability Buffer.
Key Features & Importance
The script scans hundreds of potential trendlines but only draws the one geographically closest to the current price.
Importance: This ensures you are looking at the zone that matters right now. It filters out distant or irrelevant historic lines, keeping your chart clean and focused on immediate price action.
🛡️ 5-Bar Stability Buffer (Anti-Flicker)
Feature: A hardcoded 5-bar "memory" prevents the zone from disappearing the moment price touches or breaks it.
Importance: This is critical for trading breakouts. It allows you to see the zone persist while price breaches it, helping you distinguish between a true breakout, a fakeout, or a retest, without the reference level vanishing from your screen.
🔍 Dynamic Pivot Filtering
Feature: Uses a restricted Pivot Strength (5-15) and Minimum Confirmation (2-8 touches).
Importance: By enforcing these limits, the indicator ignores insignificant market noise and micro-swings, ensuring that drawn zones represent structural market levels with genuine liquidity.
🔔 Integrated Alert System
Feature: Built-in alerts for "Zone Breakout" (candle close crossing the zone) and "Zone Touch" (wick entering the zone).
Importance: Allows you to set the indicator and walk away. You will be notified instantly when price interacts with these key levels, removing the need to stare at the chart.
📉 Adaptive Tolerance (Fixed ATR)
Feature: Uses a fixed ATR multiplier internally to determine the width of the zone.
Importance: This automatically adjusts the thickness of the support/resistance zone based on the asset's volatility.
Settings Guide
Bars to Apply: How far back in history the script looks for pivots (Default: 300).
Pivot Source: Choose between calculating from "High/Low" (wicks) or "Close" (bodies).
Pivot Strength: The number of bars required on each side to define a swing point (Range: 5–15).
Min Pivot Confirmation: The minimum number of touches required to validate a trendline (Range: 2–8).
How to Use
Add the indicator to your chart.
Adjust Pivot Strength if you want to catch smaller swings (lower number) or major structures (higher number).
Set an alert in TradingView by clicking the "Clock" icon, selecting this indicator, and choosing "Zone Breakout" or "Zone Touch".
This indicator is an automated technical analysis tool designed to identify the most relevant Support and Resistance (S&R) zones based on market pivots. Unlike standard pivot indicators that clutter the chart with historic lines, this script uses a "Closest-to-Price" algorithm to display only the single most relevant Support (Green) and Resistance (Red) zone currently interacting with price action.
It solves common frustrations with automated trendlines—specifically the issue of lines disappearing immediately upon a breakout—by introducing a Stability Buffer.
Key Features & Importance
The script scans hundreds of potential trendlines but only draws the one geographically closest to the current price.
Importance: This ensures you are looking at the zone that matters right now. It filters out distant or irrelevant historic lines, keeping your chart clean and focused on immediate price action.
🛡️ 5-Bar Stability Buffer (Anti-Flicker)
Feature: A hardcoded 5-bar "memory" prevents the zone from disappearing the moment price touches or breaks it.
Importance: This is critical for trading breakouts. It allows you to see the zone persist while price breaches it, helping you distinguish between a true breakout, a fakeout, or a retest, without the reference level vanishing from your screen.
🔍 Dynamic Pivot Filtering
Feature: Uses a restricted Pivot Strength (5-15) and Minimum Confirmation (2-8 touches).
Importance: By enforcing these limits, the indicator ignores insignificant market noise and micro-swings, ensuring that drawn zones represent structural market levels with genuine liquidity.
🔔 Integrated Alert System
Feature: Built-in alerts for "Zone Breakout" (candle close crossing the zone) and "Zone Touch" (wick entering the zone).
Importance: Allows you to set the indicator and walk away. You will be notified instantly when price interacts with these key levels, removing the need to stare at the chart.
📉 Adaptive Tolerance (Fixed ATR)
Feature: Uses a fixed ATR multiplier internally to determine the width of the zone.
Importance: This automatically adjusts the thickness of the support/resistance zone based on the asset's volatility.
Settings Guide
Bars to Apply: How far back in history the script looks for pivots (Default: 300).
Pivot Source: Choose between calculating from "High/Low" (wicks) or "Close" (bodies).
Pivot Strength: The number of bars required on each side to define a swing point (Range: 5–15).
Min Pivot Confirmation: The minimum number of touches required to validate a trendline (Range: 2–8).
How to Use
Add the indicator to your chart.
Adjust Pivot Strength if you want to catch smaller swings (lower number) or major structures (higher number).
Set an alert in TradingView by clicking the "Clock" icon, selecting this indicator, and choosing "Zone Breakout" or "Zone Touch".
發行說明
Update開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。