OPEN-SOURCE SCRIPT
Swing High-Low Line Connector

Swing High-Low Line Connector is a simple and intuitive tool that automatically detects swing highs and swing lows using fractal-style pivot logic and connects them with clean, continuous lines. This indicator helps traders visualize market structure, trend shifts, and swing-based support/resistance levels at a glance.
The script identifies each confirmed swing point based on a user-defined lookback window (left/right bars). When a new swing is confirmed, the indicator updates the previous leg or creates a new one, effectively drawing the classic “zigzag-style” connections used in discretionary trading and price-action analysis.
A dynamic tail extension is included to show the most recent swing extending toward the current price. By default, the tail follows a ZigZag-style logic—extending upward after a swing low and downward after a swing high—but users can also anchor it to Close, High, Low, or HL2.
Features
Use Cases
This indicator keeps the logic simple and visual—ideal for traders who prefer clean chart structure without unnecessary noise.
The script identifies each confirmed swing point based on a user-defined lookback window (left/right bars). When a new swing is confirmed, the indicator updates the previous leg or creates a new one, effectively drawing the classic “zigzag-style” connections used in discretionary trading and price-action analysis.
A dynamic tail extension is included to show the most recent swing extending toward the current price. By default, the tail follows a ZigZag-style logic—extending upward after a swing low and downward after a swing high—but users can also anchor it to Close, High, Low, or HL2.
Features
- Automatic detection of swing highs and swing lows
- Clean line connections between swings (similar to discretionary market-structure mapping)
- Proper consolidation handling: weaker highs/lows are ignored
- Optional ZigZag-style dynamic tail extension
- Fully customizable lookback window, line color, and line width
- Works on any market and timeframe
Use Cases
- Identifying market structure (HH, HL, LH, LL)
- Visualizing trend transitions
- Spotting breakout levels and swing-based support/resistance
- Aiding discretionary swing trading, trend following, or pattern recognition
This indicator keeps the logic simple and visual—ideal for traders who prefer clean chart structure without unnecessary noise.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội Quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.