OPEN-SOURCE SCRIPT
Swing High/Low Extensions

Swing High/Low — Extensions (2 Plots + Drawings + Touch Signal)
What it does
This indicator finds Swing Highs/Lows using a symmetric length (same bars left & right), then creates horizontal extension levels that run to the right and stop at the first price touch (“extend until future intersection”).
It outputs:
Two plots showing the most recent active High/Low extension (great for alerts & strategy logic).
Line drawings for every detected swing (historical levels stay on the chart and end at the touch bar).
A hidden TouchSignal used to color bars and trigger alerts without distorting the price scale.
The design mirrors Sierra Chart’s “Swing High and Low” with “Extend Swings Until Future Intersection”, but implemented natively in Pine.
How it determines swings
Uses ta.pivothigh() / ta.pivotlow() with length bars left and right.
A swing is confirmed only after there are length bars to the right of the center.
How extensions/lines end
High extensions end when High ≥ level.
Low extensions end when Low ≤ level.
The corresponding line drawing is frozen on the touch bar; the most recent active line continues to extend each new bar.
Inputs
Swing Strength (Bars Left = Right) – symmetric pivot length.
Offset as Percentage – 1 = +1%; positive values push levels outward (High up / Low down), negative pull them inward.
Draw “Extend…Until Future Intersection” Lines – toggle line drawings on/off.
Line Width (Plots + Drawings) – thickness for plots and drawings.
HighExt Color / LowExt Color – colors for the two plots and drawings.
Touch Color – color to paint bars on the touch bar (doesn’t affect scale).
HighExt/LowExt Line Style – choose line style (Solid/Dashed/Dotted) for drawings.
Color Bars on Touch? – enable/disable bar coloring.
Bar Color on High Touch / Low Touch – separate bar colors for each side.
Bar Color Transparency (0..100) – opacity for the bar painting.
Plots
HighExt – latest active high extension only.
LowExt – latest active low extension only.
(Internally there is also a hidden “TouchSignal” plot used for bar coloring & alerts; it’s not displayed to keep the chart scale clean.)
Alerts
Three built-in alertconditions:
Any Extension Touched — triggers when either side is hit.
High Extension Touched — only high level touch.
Low Extension Touched — only low level touch.
Create alerts from the indicator’s “More” (⋯) menu → Add alert → choose one of the conditions.
Styling
Drawings use your selected style (Solid/Dashed/Dotted), color, and width.
Existing historical lines adopt new styles when the script recalculates.
Bar coloring highlights the exact touch candle; disable it if you prefer clean candles.
Notes & tips
Scale-safe: the TouchSignal is hidden (display=none), so it won’t distort the Y-axis.
Performance: TradingView limits scripts to ~500 line objects; this script uses max_lines_count=500. If you hit the cap on long histories, either increase timeframe or disable drawings and rely on the two plots + alerts.
Works on any symbol/timeframe; levels are rounded to the instrument’s minimum tick.
Intended use
For discretionary levels, alerting, and rule-based entries that react to first touch of recent swing extensions. Not financial advice—use at your own risk.
What it does
This indicator finds Swing Highs/Lows using a symmetric length (same bars left & right), then creates horizontal extension levels that run to the right and stop at the first price touch (“extend until future intersection”).
It outputs:
Two plots showing the most recent active High/Low extension (great for alerts & strategy logic).
Line drawings for every detected swing (historical levels stay on the chart and end at the touch bar).
A hidden TouchSignal used to color bars and trigger alerts without distorting the price scale.
The design mirrors Sierra Chart’s “Swing High and Low” with “Extend Swings Until Future Intersection”, but implemented natively in Pine.
How it determines swings
Uses ta.pivothigh() / ta.pivotlow() with length bars left and right.
A swing is confirmed only after there are length bars to the right of the center.
How extensions/lines end
High extensions end when High ≥ level.
Low extensions end when Low ≤ level.
The corresponding line drawing is frozen on the touch bar; the most recent active line continues to extend each new bar.
Inputs
Swing Strength (Bars Left = Right) – symmetric pivot length.
Offset as Percentage – 1 = +1%; positive values push levels outward (High up / Low down), negative pull them inward.
Draw “Extend…Until Future Intersection” Lines – toggle line drawings on/off.
Line Width (Plots + Drawings) – thickness for plots and drawings.
HighExt Color / LowExt Color – colors for the two plots and drawings.
Touch Color – color to paint bars on the touch bar (doesn’t affect scale).
HighExt/LowExt Line Style – choose line style (Solid/Dashed/Dotted) for drawings.
Color Bars on Touch? – enable/disable bar coloring.
Bar Color on High Touch / Low Touch – separate bar colors for each side.
Bar Color Transparency (0..100) – opacity for the bar painting.
Plots
HighExt – latest active high extension only.
LowExt – latest active low extension only.
(Internally there is also a hidden “TouchSignal” plot used for bar coloring & alerts; it’s not displayed to keep the chart scale clean.)
Alerts
Three built-in alertconditions:
Any Extension Touched — triggers when either side is hit.
High Extension Touched — only high level touch.
Low Extension Touched — only low level touch.
Create alerts from the indicator’s “More” (⋯) menu → Add alert → choose one of the conditions.
Styling
Drawings use your selected style (Solid/Dashed/Dotted), color, and width.
Existing historical lines adopt new styles when the script recalculates.
Bar coloring highlights the exact touch candle; disable it if you prefer clean candles.
Notes & tips
Scale-safe: the TouchSignal is hidden (display=none), so it won’t distort the Y-axis.
Performance: TradingView limits scripts to ~500 line objects; this script uses max_lines_count=500. If you hit the cap on long histories, either increase timeframe or disable drawings and rely on the two plots + alerts.
Works on any symbol/timeframe; levels are rounded to the instrument’s minimum tick.
Intended use
For discretionary levels, alerting, and rule-based entries that react to first touch of recent swing extensions. Not financial advice—use at your own risk.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.
오픈 소스 스크립트
진정한 트레이딩뷰 정신에 따라 이 스크립트 작성자는 트레이더가 기능을 검토하고 검증할 수 있도록 오픈소스로 공개했습니다. 작성자에게 찬사를 보냅니다! 무료로 사용할 수 있지만 코드를 다시 게시할 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
이 정보와 게시물은 TradingView에서 제공하거나 보증하는 금융, 투자, 거래 또는 기타 유형의 조언이나 권고 사항을 의미하거나 구성하지 않습니다. 자세한 내용은 이용 약관을 참고하세요.