Free: indicator teardowns, a repaint checker and open-source scripts. No buy/sell signals, ever.

Taught to TradeSystems over signals.

Explainers / ZigZag++

ZigZag++, explained from the source

ZigZag++ by DevLucem is the most-boosted zigzag on TradingView. It joins swing highs and lows with straight lines, tags each turn HH, HL, LH or LL, and shades the background by direction. It is built to work like the classic MT4 ZigZag, with the same three settings: Depth, Deviation and Backstep. The question everyone asks is whether it repaints. The answer from the code: the direction does not, the last leg does, by design.

The three settings

How it decides direction

On every bar the script counts two things: bars since price was last at a new Depth-bar high, and bars since it was last at a new Depth-bar low. If the new low is more recent than the new high, and that has been true for at least Backstep bars, the direction is down. Otherwise it is up.

Both counts are taken from the previous bar. So the direction for a bar is settled when that bar opens, and it cannot flip back and forth while the bar is forming.

How it draws the legs

While the direction is up, the script tracks the highest high since the last flip; that is the end of the current leg. When the direction flips to down, that high becomes a fixed pivot, and the script starts tracking the lowest low. The HH/LH (or HL/LL) label compares the new pivot with the previous pivot of the same kind.

Does ZigZag++ repaint?

Yes, the last leg does, and the setting that controls it is called "Repaint Levels" and is ON by default. While a leg is still running, the script deletes its line and label every bar and draws them again to the newest extreme. So:

Earlier legs do not move. Once the direction flips, the old end point is fixed for good.

Turn "Repaint Levels" off and each leg is drawn only after the direction has flipped. Nothing on the chart moves, but every line appears one leg late. Neither mode knows a pivot is a pivot until price has already moved away from it. More in what repainting is, or test a script with the repaint checker.

How late is a pivot?

The pivot is confirmed on the bar the direction flips, which comes after the extreme bar. On random-walk prices (our simulation, 100,000 bars, ZigZag++'s rule re-implemented exactly):

Settingnew leg everypivot confirmed after the extreme
Depth 12, Deviation 5, Backstep 2 (default)17 barsmedian 7 bars (1 in 10 took 12 or more)
Depth 57 bars4 bars
Depth 3044 bars16 bars
Backstep 519 bars9 bars

At the default, the end of the live leg moved on about 30% of bars, the live label changed its text in about one leg in four, and the HH/LH/HL/LL alerts fired about five times per leg. Random-walk prices have nothing to predict, so these numbers describe how the rule reacts to noise, not how it trades.

Deviation is in ticks

Deviation is multiplied by the symbol's minimum tick. On a stock or a crypto pair quoted to 0.01, 5 ticks is five cents, far smaller than a typical bar, so Deviation 1 and Deviation 5 gave almost the same legs in our simulation. On a futures contract with a 0.25 tick, 5 ticks is 1.25 points. Copying "best settings" from another market copies a different setting. In our simulation Deviation also did not act as a simple minimum swing size: some larger values gave more legs, not fewer. Change it and look, rather than assume.

Where it fails

Also explained: Pivot highs and lows · HalfTrend · Repainting · Repaint checker

Educational only. Not financial advice. Nothing here is a recommendation to buy or sell anything. ZigZag++ is by DevLucem on TradingView; this page explains its published open-source code and is not affiliated with the author.

Also explained: Repaint checker, VWAP, Supertrend, RSI, UT Bot Alerts, Nadaraya-Watson Envelope, Squeeze Momentum, What is repainting on TradingView?, Is TradingView backtesting accurate?, Chandelier Exit, WaveTrend Oscillator, QQE MOD, Pivot highs and lows, Hull Suite, Range Filter, Twin Range Filter, HalfTrend, SSL Hybrid, CM MacD Ultimate MTF, Volume Profile / Fixed Range, ADX and DI, Support Resistance Channels, Market Structure Break & Order Block, Order Block Finder, Pivot Point SuperTrend, Trendlines with Breaks [LuxAlgo], Divergence for Many Indicators, TradingView script selling terms, Support and Resistance Levels with Break, Liquidity Swings [LuxAlgo], Pine Script errors, Breakout Probability (Expo), Did ChatGPT or Claude write your Pine Sc, Lorentzian Classification, SuperTrend AI (Clustering), Machine Learning Adaptive SuperTrend, Dynamic Swing Anchored VWAP, Support and Resistance Power Channel by , Support and Resistance (High Volume Boxe, Trendline Breakouts With Targets by Char, Breakout Finder by LonesomeTheBlue

Next steps

  • Get a script fixed. Compiles but behaves differently live, or changes after a reload? In a Pine Script Audit, an AI model reads every line and writes a report on what to fix for $49, or also fixes those problems for $149. It cannot prove a script is safe.
  • Check your own script. Paste its source into the free repaint checker. It runs in your browser and flags known patterns.
Subscribe to the Teardown Letter: $19/moBack to Taught to Trade

No TradingView account yet? This affiliate link gives you a $15 coupon toward a paid plan, and we earn a commission if you buy one. The free plan is enough to follow this page.