OPEN-SOURCE SCRIPT
Updated

Zig Zag with HHLL

624
This powerful tool calculates and displays two Zig Zag patterns simultaneously while dynamically identifying key market structure points—Higher Highs (HH), Lower Lows (LL), Higher Lows (HL), and Lower Highs (LH).

Because the script is dynamic, the most recent HH, HL, LL, or LH can update in real-time as price action evolves. For example, if the price continues to rise, a previously marked HL may be reclassified as an LL. Likewise, a falling LH may later turn into a HH if the market reverses.

This script is versatile and can be applied to various trading strategies, including trend analysis, support and resistance identification, breakout setups, and more.


Added a new input parameter decimals that allows you to control the decimal precision:

Set to -1 (default) for automatic detection based on the symbol's minimum tick size
Set to 0-8 for a specific number of decimal places.

How it works:

Auto mode (decimals = -1): The script automatically determines how many decimal places to show based on the instrument's minimum tick size. For example:

Forex pairs (0.00001) → 5 decimals
Stocks ($0.01) → 2 decimals
Crypto (0.00000001) → 8 decimals

Manual mode (decimals = 0-8): You can force a specific number of decimal places if needed
Release Notes
Ehanced with fractals.

Key Benefits:

Comprehensive Analysis: Combines Zig Zag trend analysis with precise fractal identification
Clean Interface: Well-organized input groups make the script easy to configure
Flexible Display: Independent toggles for Zig Zag lines, HHLL labels, and fractals
Advanced Fractal Logic: Handles equal highs/lows for more accurate fractal detection
Visual Harmony: Fractals use subtle transparency (25%) to complement the Zig Zag lines

The script now provides a comprehensive market structure analysis tool, displaying both major trend changes (ZigZag) and precise reversal points (fractals) with full customization options. You can use them together for comprehensive analysis or independently as needed.
Release Notes
Updated the script to allow accurate price display across all instruments

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.