All indicators

Double Zig Zag with HHLL

Nov 4, 2020

Static chart image
SignalsPatternsPivot Based (Retrospective)

The Double Zig Zag with HHLL indicator plots two concurrent Zig Zag lines with different periods and automatically labels market structure points such as Higher Highs (HH), Lower Lows (LL), Higher Lows (HL), and Lower Highs (LH) for trend and breakout analysis.

Usage

The Usage section describes how the script can be used to identify market structure and trend shifts. Traders can utilize the dual Zig Zag lines to visualize both short-term and long-term price swings simultaneously.

  • Trend Identification: By tracking the sequence of HH/HL or LH/LL labels, users can determine the current market regime. A sequence of Higher Highs and Higher Lows indicates a bullish trend, while Lower Highs and Lower Lows indicate a bearish trend.
  • Support and Resistance: The pivot points generated by the Zig Zag lines serve as dynamic support and resistance levels.
  • Breakout Analysis: Significant breaks above a previous HH or below a previous LL often signal potential trend continuations or reversals.

The labels are dynamic; if price action continues beyond a previous pivot point before a new leg is confirmed, the labels will update in real-time to reflect the new extreme.

Details

The script calculates two independent Zig Zag paths based on user-defined lookback periods. It uses the ta.highestbars and ta.lowestbars functions to detect local peaks and troughs.

The market structure labels are determined by comparing the current pivot price to the second-to-last pivot of the same type:

  • HH (Higher High): Current high is higher than the previous high.
  • LH (Lower High): Current high is lower than the previous high.
  • LL (Lower Low): Current low is lower than the previous low.
  • HL (Higher Low): Current low is higher than the previous low.

Lines and labels are managed using arrays to ensure only the most relevant historical pivots are displayed and updated, maintaining chart clarity.

Settings

  • ZigZag Period 1: Sets the lookback period for the first (typically faster) Zig Zag calculation.
  • ZigZag Period 2: Sets the lookback period for the second (typically slower) Zig Zag calculation.
  • Show Zig Zags: Dropdown to display Zig Zag 1, Zig Zag 2, both, or none.
  • Show HHLL: Dropdown to display market structure labels for Zig Zag 1, Zig Zag 2, both, or none.
  • Zig Zag Up/Down Colors: Customizes the line colors for bullish and bearish legs for both Zig Zag sets.
  • Zig Zag 1 Line Style: Choose between "Dashed" or "Dotted" styles for the first Zig Zag.
  • Line Widths: Adjusts the thickness of the lines for both Zig Zag 1 and Zig Zag 2.

FAQ

How do the dynamic labels work? The labels update in real-time as price moves. If a price makes a new high before the Zig Zag direction changes, the "HH" or "LH" label will move to the newest high point.

Can I use this for automated alerts? Yes, the script includes built-in alert conditions that trigger whenever the direction of Zig Zag 1 or Zig Zag 2 changes.

How can I access the Double Zig Zag with HHLL? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.

Free indicator

Get free access to this indicator on the platforms below.

TradingView
NinjaTrader
MetaTrader 4/5

Unlock the entire LuxAlgo Library

Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.