OPEN-SOURCE SCRIPT
Auto Structure Lines

Auto Structure Lines automatically detects recent swing highs and swing lows, then plots clean support and resistance levels on the chart. It is designed to help traders quickly identify nearby structure, breakout areas, rejection zones, and possible pullback levels without manually drawing every line.
The indicator uses confirmed pivot highs and lows to create resistance and support lines. Nearby levels are merged using an ATR-based tolerance so the chart stays cleaner and avoids stacking multiple lines around the same price area.
Key features:
Automatically detects pivot-based support and resistance
Extends structure lines to the right side of the chart
Stores multiple historical levels while showing only the most recent visible levels
ATR-based level merging to reduce clutter
Optional price labels for each visible level
Customizable pivot length, line style, colors, width, and label offset
Separate toggles for support and resistance
This tool is useful for identifying important price areas, planning breakout entries, watching retests, and managing risk around nearby support or resistance.
Auto Structure Lines is a visual decision-support tool. It does not generate buy or sell signals by itself and should be used with price action, volume, trend context, and your own risk management.
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.