Zig Zag is a price chart overlay that simplifies the up and down movements and transitions based on a percent change smoothing threshold. [Discuss]
// usage IEnumerable<ZigZagResult> results = quotes.GetZigZag(endType, percentChange);
EndType - Determines whether
High/Low are used to measure percent change. See EndType options below. Default is
decimal - Percent change required to establish a line endpoint. Example: 3.5% would be entered as 3.5 (not 0.035). Must be greater than 0. Typical values range from 3 to 10. Default is 5.
Historical quotes requirements
You must have at least two periods of
quotes to cover the warmup periods, but notably more is needed to be useful.
quotes is a collection of generic
TQuote historical price quotes. It should have a consistent frequency (day, hour, minute, etc). See the Guide for more information.
EndType.Close - Percent change measured from
Close price (default)
EndType.HighLow - Percent change measured from
- This method returns a time series of all available indicator values for the
- It always returns the same number of elements as there are in the historical quotes.
- It does not return a single incremental indicator value.
- If you do not supply enough points to cover the percent change, there will be no Zig Zag points or lines.
- The first line segment starts after the first confirmed point; ZigZag values before the first confirmed point will be
- The last line segment is an approximation as the direction is indeterminate.
Warning: depending on the specified
endType, the indicator cannot be initialized if the first
Closevalue of 0 (zero).
Repaint warning: the last line segment will always be redrawn back to the last known pivot. Do not attempt to calculate incremental values since previous values may change based on newer quotes.
DateTime - Date from evaluated
decimal - Zig Zag line for
string - Zig Zag endpoint type (
H for high point,
L for low point)
decimal - Retrace line for high points
decimal - Retrace line for low points
See Utilities and helpers for more information.
Results can be further processed on
ZigZag with additional chain-enabled indicators.
// example var results = quotes .GetZigZag(..) .GetSlope(..);
This indicator must be generated from
quotes and cannot be generated from results of another chain-enabled indicator or method.