ZigZag: the swings that are left once every move smaller than deviation
percent is filtered out. The percent-reversal definition:
While a swing rises, its end is the highest high since it began. A bar
whose low is at least deviation percent below that high confirms the high
as a swing point and starts a falling swing at the bar's low. A falling
swing is the mirror image. A bar that makes a new extreme extends the swing
even when its other end would also have reversed it, and a tie keeps the
earlier bar.
Before the first reversal the highest high and the lowest low since the
first bar are both open, and the first time they lie deviation percent
apart, the earlier of the two becomes the first swing point.
zigzag holds each swing point's price on its own bar, the running end of
the last leg included, and nothing elsewhere; the legs are drawn between
them, the last one dashed. Only the last leg ever repaints. On a live tick
that makes a new extreme its end moves onto the forming bar and the bar it
left reads empty again; a tick that retraces by deviation confirms the end
and starts a new last leg on the forming bar; a corrected bar can move the
end back. Confirmed swing points never move, and calcTail returns exactly
what a full calc of the same bars does (see zigzagTail).
The legs are shapes, not a plot, so a leg is straight on a logarithmic scale
too, and they take their colour, opacity, thickness and line style from the
plot's own style settings.
ZigZag: the swings that are left once every move smaller than
deviationpercent is filtered out. The percent-reversal definition:deviationpercent below that high confirms the high as a swing point and starts a falling swing at the bar's low. A falling swing is the mirror image. A bar that makes a new extreme extends the swing even when its other end would also have reversed it, and a tie keeps the earlier bar.deviationpercent apart, the earlier of the two becomes the first swing point.zigzagholds each swing point's price on its own bar, the running end of the last leg included, and nothing elsewhere; the legs are drawn between them, the last one dashed. Only the last leg ever repaints. On a live tick that makes a new extreme its end moves onto the forming bar and the bar it left reads empty again; a tick that retraces bydeviationconfirms the end and starts a new last leg on the forming bar; a corrected bar can move the end back. Confirmed swing points never move, andcalcTailreturns exactly what a fullcalcof the same bars does (seezigzagTail).The legs are shapes, not a plot, so a leg is straight on a logarithmic scale too, and they take their colour, opacity, thickness and line style from the plot's own style settings.