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.
版本注释
Release Notes – Swing High-Low Line ConnectorThis update includes several improvements and clarifications to the script, along with
a detailed explanation of how the indicator supports market-structure analysis and
Dow Theory validation.
Changes:
1. Converted all in–script comments from Japanese to English for clarity.
2. Removed unintended trailing spaces in the 'Line Width' input label.
3. Removed trailing spaces from the 'Close' option in Tail Anchor Mode to ensure correct behavior.
Additional Notes:
• This indicator is fully non-repainting.
Swing highs and lows are confirmed only after the required number of bars have passed.
Once a swing point is confirmed, its value and the connecting line never change.
• The indicator implements a clean, pivot-based swing mapping technique.
It uses confirmed fractal-style highs and lows, filters out weaker pivots,
and connects swings with continuous lines similar to discretionary trend analysis.
• The dynamic tail connection follows ZigZag-style logic by default:
After a confirmed swing low, the tail extends upward using the bar's High;
after a confirmed swing high, it extends downward using the bar's Low.
Users may switch the tail anchor to Close, High, Low, or HL2 if preferred.
Dow Theory Application:
This indicator is highly effective for visualizing and validating Dow Theory market structure.
The connected swing points form a clear representation of:
• HH / HL sequences in an uptrend,
• LH / LL sequences in a downtrend.
Because swings are confirmed and do not repaint, traders can reliably use these
highs and lows to identify trend continuation, trend reversals, and the formation
of significant structural points such as higher lows, lower highs, and break-of-structure zones.
The tool is particularly helpful for:
• Confirming trend direction using Dow Theory,
• Analyzing swing-based support and resistance,
• Visualizing market structure transitions,
• Assisting discretionary technical analysis and price-action trading.
This script is designed to remain simple, intuitive, and visually clean while providing
structural information that is essential to many trading methodologies.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。