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. קרא עוד ב־תנאי השימוש.