Description
Implement ZigZag indicator
The ZigZag indicator is a technical analysis tool used in trading to help identify price trends and reversals by filtering out small, insignificant price movements. It does not predict future price movements, but it simplifies the visual representation of price charts, making it easier to spot significant highs and lows (peaks and troughs). The indicator finds local highs and lows that exceed a percentage deviation threshold from the last confirmed point.
Calculations
The Zig Zag indicator can be calculated with the following formula:
ZigZag (HL, % change = X , retrace = FALSE, LastExtreme = TRUE)
If % change > = X, plot ZigZag
Definitions
HL = High-Low price series or Closing price series
% change = Minimum price movement (as a percentage).
Retrace = This can be the change in the retracement of a previous move, change a retracement of the previous move, or it can also be an absolute change from peak to trough.
LastExtreme = This references extreme price, if it is the same over multiple periods (usually the first or last price observation).