OPEN-SOURCE SCRIPT
ZigZag

ZigZag Indicator – Overview
How It Works
Settings
What You See on the Chart
Why This ZigZag Is Useful
Recommended Use Cases
This ZigZag indicator highlights the most important swing highs and swing lows on the chart, helping traders see market structure more clearly by filtering out minor price movements. It connects significant turning points with straight lines, creating a clean visual representation of trend direction and major reversals.
How It Works
- Price constantly moves up and down, but not every movement is meaningful. The ZigZag indicator waits for price to make a move large enough to be considered a true swing point. Once such a movement occurs, the indicator identifies it as either a swing high or a swing low and draws a line connecting it to the previous swing.
- This produces a simplified outline of market structure, making it easier to recognize trends, corrections, and major turning points.
Settings
- ZigZag Length
Controls the sensitivity of the indicator.
Lower values produce more frequent swing points.
Higher values show only major swings and reduce noise. - Show ZigZag
Enables or disables the visual lines. When disabled, the indicator continues tracking swing points internally.
What You See on the Chart
- Every time the market creates a confirmed swing high or swing low, the indicator draws a line to the previous swing in the opposite direction.
- After a major low is confirmed, a line is drawn to the most recent high.
- After a major high is confirmed, a line is drawn to the most recent low.
- This creates a clear, continuous zigzag that outlines the dominant movements of the market without reacting to every small fluctuation.
Why This ZigZag Is Useful
- It does not repaint once a swing is confirmed.
- It provides a clean and simplified view of price structure.
- It helps identify trend direction, structure breaks, impulses, and corrections.
- It is useful for traders who follow price action, smart money concepts, and swing-based strategies.
Recommended Use Cases
- This ZigZag indicator is suited for traders who rely on market structure analysis, including:
- Swing trading
- Smart Money Concepts (BOS/CHOCH detection)
- Identifying impulses and pullbacks
- Finding strong highs and lows
- Studying overall trend direction
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.