ZigZag {TTR} | R Documentation |
Zig Zag
Description
Zig Zag higlights trends by removing price changes smaller than change
and interpolating lines between the extreme points.
Usage
ZigZag(HL, change = 10, percent = TRUE, retrace = FALSE, lastExtreme = TRUE)
Arguments
HL |
Object that is coercible to xts or matrix and contains either a High-Low price series, or a Close price series. |
change |
Minimum price movement, either in dollars or percent (see
|
percent |
Use percentage or dollar change? |
retrace |
Is |
lastExtreme |
If the extreme price is the same over multiple periods, should the extreme price be the first or last observation? |
Details
The Zig Zag is non-predictive. The purpose of the Zig Zag is filter noise and make chart patterns clearer. It's more a visual tool than an indicator.
Value
A object of the same class as HL
or a vector (if
try.xts
fails) containing the Zig Zag indicator.
Warning
The last value of the ZigZag indicator is unstable (i.e. unknown) until the turning point actually occurs. Therefore this indicator isn't well-suited for use for systematic trading strategies.
Note
If High-Low prices are given, the function calculates the max/min using the high/low prices. Otherwise the function calculates the max/min of the single series.
Author(s)
Joshua Ulrich
References
The following site(s) were used to code/document this
indicator:
https://www.fmlabs.com/reference/default.htm?url=ZigZag.htm
https://www.linnsoft.com/techind/zig-zag-indicator-zig-zzo
https://www.linnsoft.com/techind/zig-zag-oscillator-indicator-zzo
https://www.metastock.com/Customer/Resources/TAAZ/?p=127
https://school.stockcharts.com/doku.php?id=technical_indicators:zigzag
Examples
## Get Data and Indicator ##
data(ttrc)
zz <- ZigZag( ttrc[,c("High", "Low")], change=20 )