All indicators

AlgoSentry ZigZag Trend

Jun 4, 2026

Static chart image
Price Action BasedSignalsDashboardMoving AveragesVolatilityRepainting Functionality

The AlgoSentry ZigZag Trend indicator is a non-repainting market structure tool that maps volatility-adjusted price swings to identify high-probability trend continuations and pullbacks. It utilizes an adaptive ZigZag algorithm and multi-layer filters to confirm signals only upon candle close, ensuring historical data matches live performance without hindsight bias.

Usage

The Usage section describes how the script can be used to navigate market trends and corrective phases. Users should generally trade in the direction of the prevailing trend as defined by the moving average and optional filters.

The indicator identifies a four-stage sequence for trade setups:

  1. Red (Correction): Indicates a counter-trend move has begun.
  2. Magenta (MA Touch): Signals that price has retraced to the moving average during a correction.
  3. Orange (Counter-Pivot): Triggered when the ZigZag prints a counter-pivot, suggesting the pullback is turning back toward the trend.
  4. Green (Confirmed Continuation): The primary signal confirming the resumption of the trend. This locks on bar close and can be set to require a break of the prior pivot for higher conviction.

Users can toggle "Minimal Mode" to hide early-stage labels (Red/Magenta) for a cleaner chart focused solely on execution triggers. The ADX and SMA-200 filters should be used to suppress signals during sideways markets or when price is trading against the long-term regime.

Details

The script is constructed using several core logic modules:

  • Adaptive ZigZag: Instead of a fixed percentage, the ZigZag deviation is scaled by the Average True Range (ATR). This allows the structure to adapt dynamically to changing market volatility.
  • Non-Repainting Logic: All labels, lines, and alerts are gated by barstate.isconfirmed. This prevents markers from vanishing or shifting after they appear.
  • Multi-Filter Regime: The tool combines a slope-colored Moving Average (EMA or SMA), an ADX trend strength filter, and an optional higher-timeframe (HTF) filter to ensure signals align with broader market momentum.
  • Pullback Grading: Corrective legs are measured against the preceding impulse move and categorized into tiers (Red, Orange, Green) based on retracement depth.

Settings

ZigZag

  • Deviation %: The minimum percentage move required to confirm a new ZigZag pivot.
  • Depth: The minimum number of bars required between pivots.
  • Adaptive Deviation: Scales the ZigZag deviation based on ATR to account for volatility.
  • Use HA High/Low: Uses Heikin Ashi values for pivot extremes instead of regular price.

Quality / Filters

  • Filter chop with ADX: Suppresses signals when the ADX is below the user-defined threshold.
  • Higher-timeframe trend filter: Requires the current price to be on the correct side of an HTF moving average (processed without lookahead).
  • GREEN requires CLOSE beyond pivot: A strict mode where the continuation signal only fires if the candle closes past the previous ZigZag high/low.

Visual / MA

  • Minimal mode: Toggles visibility of early correction markers for a cleaner interface.
  • MA Type/Length: Sets the period and type (SMA/EMA) for the trend-defining moving average.
  • Slope Threshold: The minimum percentage change required for the MA to change color, filtering out "flat" moving averages.
  • Filter with SMA200: Adds a long-term trend filter where signals only fire if price and the MA are above (for longs) or below (for shorts) the 200-period SMA.

FAQ

How do I reduce false signals in sideways markets? Enable the ADX filter and set the "Min ADX" higher (e.g., 25+). You can also enable the SMA-200 and Higher-Timeframe trend filters to ensure you are only trading with the primary market regime.

Why did a signal appear and then stay on the chart? The indicator is designed to be non-repainting. It waits for the bar to close before printing a signal. This ensures that the "Green" or "Orange" markers you see in backtesting are exactly where they would have appeared in real-time.

How do I access the AlgoSentry ZigZag Trend? 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.