AlgoSentry ZigZag Trend
Jun 4, 2026

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:
- Red (Correction): Indicates a counter-trend move has begun.
- Magenta (MA Touch): Signals that price has retraced to the moving average during a correction.
- Orange (Counter-Pivot): Triggered when the ZigZag prints a counter-pivot, suggesting the pullback is turning back toward the trend.
- 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.
Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.
As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.
Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.
Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.
This does not represent our full Disclaimer. Please read our full disclaimer.
© 2026 LuxAlgo Global, LLC.

