NC Swing/Zig-Zag Description
NC Swing/Zig-Zag is a zig zag and swing indicator for NinjaTrader 8, and it comes with the full C# source code. Most zig zags are static: one fixed deviation that's too big when the market is quiet and too small when it's wild. So I added an ATR mode that lets the swings adapt, plus the numbers I wanted on every swing. One honest note: the last swing is still forming and can move until the next one is confirmed.
How it works. It finds pivots with the same algorithm as my Pivot Analyzer: a high needs Hill Size Bars on each side (2 by default), each lower by at least Minimum Drop Size Points (1), and a low is the mirror. Then it joins them into swings. While a swing heads up, every higher pivot high moves its top up. It only turns down when a pivot low comes more than the deviation below that top, and the same in reverse. In Points mode (the default) the deviation is Deviation Value in Points (3). In ATR mode it's the current ATR(50) times 2, so fast markets need bigger moves to flip a swing.
What you see. A blue line joins the swing points. Show Swing Levels adds a green line at the last swing high and a red one at the last swing low, and Connect Peaks joins high to high and low to low. A box on each finished swing can show its number, leg size, Peaks Delta (distance from the previous peak), leg volume and average leg size. The number counts higher highs as +1, +2, +3 and lower highs as -1, -2 (lows the same way), and the box is green for higher, red for lower. Optional diamonds mark the pivots, and breakout arrows show closes past the previous swing. Only the line is on by default, and it calculates on bar close.
How to use it. Minimum Drop Size and Deviation are in points of price, so set them for your instrument: 3 points is small on Nasdaq futures and huge on a forex pair. ATR mode adapts the deviation for you. Use the swing levels for stops and targets.
Make it yours. Use it as is, learn from the code, or change it yourself or with AI like Claude. Strategies can already read the swings, levels, swing numbers and breakout signal. You could add an alert on the breakout, a percent-based minimum drop that fits every market, or take breakouts only after a +2 swing. Pivots, swings, data boxes and drawing each have their own region in the code, so you know where to start. Have some good trades!