PINE LIBRARY
ZigZag

Library "ZigZag"
method lastPivot(this)
Retrieves the last `Pivot` object's reference from a `ZigZag` object's `pivots`
array if it contains at least one element, or `na` if the array is empty.
Callable as a method or a function.
Namespace types: ZigZag
Parameters:
this (ZigZag): (series ZigZag) The `ZigZag` object's reference.
Returns: (Pivot) The reference of the last `Pivot` instance in the `ZigZag` object's
`pivots` array, or `na` if the array is empty.
method update(this, sourceHigh, sourceLow)
Updates a `ZigZag` object's pivot information, volume data, lines, and
labels when it detects new pivot points.
NOTE: This function requires a single execution on each bar for accurate
calculations.
Callable as a method or a function.
Namespace types: ZigZag
Parameters:
this (ZigZag): (series ZigZag) The `ZigZag` object's reference.
sourceHigh (float): (series float) The data series to analyze for high pivot points.
sourceLow (float): (series float) The data series to analyze for low pivot points.
Returns: (bool) `true` if the function detects a new pivot point and updates the
`ZigZag` object's data, `false` otherwise.
newInstance(settings)
Creates a new `ZigZag` instance with optional settings.
Parameters:
settings (Settings): (series Settings) Optional. A `Settings` object's reference for the new
`ZigZag` instance's `settings` field. If `na`, the `ZigZag` instance
uses a new `Settings` object with default properties. The default is `na`.
Returns: (ZigZag) A new `ZigZag` object's reference.
Settings
A structure for objects that store calculation and display properties for `ZigZag` instances.
Fields:
devThreshold (series float): The minimum percentage deviation from a previous pivot point required to change the Zig Zag's direction.
depth (series int): The number of bars required for pivot point detection.
lineColorUp (series color): The color of each line in the Zig Zag drawing that connects pivot highs.
lineColorDown (series color): The color of each line in the Zig Zag drawing that connects pivot lows.
textUpColor (series color): The color of the text in each label that shows a pivot high's price and volume.
textDownColor (series color): The color of the text in each label that shows a pivot low's price and volume.
lineWidth (series int): The width of the Zig Zag lines.
extendLast (series bool): Specifies whether the Zig Zag drawing includes a line connecting the most recent pivot point to the latest bar's `close`.
displayReversalPrice (series bool): Specifies whether the Zig Zag drawing shows pivot prices in its labels.
displayCumulativeVolume (series bool): Specifies whether the Zig Zag drawing shows the cumulative volume between pivot points in its labels.
displayReversalPriceChange (series bool): Specifies whether the Zig Zag drawing shows the reversal amount from the previous pivot point in each label.
differencePriceMode (series string): The reversal amount display mode. Possible values: `"Absolute"` for price change or `"Percent"` for percentage change.
draw (series bool): Specifies whether the Zig Zag drawing displays its lines and labels.
allowZigZagOnOneBar (series bool): Specifies whether the Zig Zag calculation can register a pivot high *and* pivot low on the same bar.
drawSupportResistance (series bool): Specifies whether the Zig Zag drawing includes support and resistance lines.
supportResistanceOffset (series int): The number of bars to extend the support and resistance lines from the last pivot point.
supportResistanceWidth (series int): The width of the support and resistance lines.
supportColor (series color): The color of the support lines.
resistanceColor (series color): The color of the resistance lines.
supportResistanceZoneWidth (series int): The width of the support and resistance zones.
drawSupportResistanceZone (series bool): Specifies whether the Zig Zag drawing includes support and resistance zones.
supportZoneColor (series color): The color of the support zone.
resistanceZoneColor (series color): The color of the resistance zone.
supportResistanceExtend (series bool): Specifies whether the support and resistance lines extend to the right of the chart.
overlay (series bool): Specifies whether the Zig Zag drawing appears on the main chart or in a separate pane.
zigZagLineStyle (series string): The line style of the Zig Zag lines. Possible values: `line.style_solid`, `line.style_dotted`, `line.style_dashed`, `line.style_arrow_left`, `line.style_arrow_right`, or `line.style_arrow_both`.
supportResistanceLineStyle (series string): The line style of the support and resistance lines. Possible values: `line.style_solid`, `line.style_dotted`, `line.style_dashed`, `line.style_arrow_left`, `line.style_arrow_right`, or `line.style_arrow_both`.
Pivot
A structure for objects that store chart point references, drawing references, and volume information for `ZigZag` instances.
Fields:
ln (series line): References a `line` object that connects the coordinates from the `start` and `end` chart points.
lb (series label): References a `label` object that displays pivot data at the `end` chart point's coordinates.
isHigh (series bool): Specifies whether the pivot at the `end` chart point's coordinates is a pivot high.
vol (series float): The cumulative volume across the bars between the `start` and `end` chart points.
start (chart.point): References a `chart.point` object containing the coordinates of the previous pivot point.
end (chart.point): References a `chart.point` object containing the coordinates of the current pivot point.
supportResistance (series line)
supportResistanceZone (series line)
ZigZag
A structure for objects that maintain Zig Zag drawing settings, pivots, and cumulative volume data.
Fields:
settings (Settings): References a `Settings` object that specifies the Zig Zag drawing's calculation and display properties.
pivots (array<Pivot>): References an array of `Pivot` objects that store pivot point, drawing, and volume information.
sumVol (series float): The cumulative volume across bars covered by the latest `Pivot` object's line segment.
extend (Pivot): References a `Pivot` object that projects a line from the last confirmed pivot point to the current bar's `close`.
method lastPivot(this)
Retrieves the last `Pivot` object's reference from a `ZigZag` object's `pivots`
array if it contains at least one element, or `na` if the array is empty.
Callable as a method or a function.
Namespace types: ZigZag
Parameters:
this (ZigZag): (series ZigZag) The `ZigZag` object's reference.
Returns: (Pivot) The reference of the last `Pivot` instance in the `ZigZag` object's
`pivots` array, or `na` if the array is empty.
method update(this, sourceHigh, sourceLow)
Updates a `ZigZag` object's pivot information, volume data, lines, and
labels when it detects new pivot points.
NOTE: This function requires a single execution on each bar for accurate
calculations.
Callable as a method or a function.
Namespace types: ZigZag
Parameters:
this (ZigZag): (series ZigZag) The `ZigZag` object's reference.
sourceHigh (float): (series float) The data series to analyze for high pivot points.
sourceLow (float): (series float) The data series to analyze for low pivot points.
Returns: (bool) `true` if the function detects a new pivot point and updates the
`ZigZag` object's data, `false` otherwise.
newInstance(settings)
Creates a new `ZigZag` instance with optional settings.
Parameters:
settings (Settings): (series Settings) Optional. A `Settings` object's reference for the new
`ZigZag` instance's `settings` field. If `na`, the `ZigZag` instance
uses a new `Settings` object with default properties. The default is `na`.
Returns: (ZigZag) A new `ZigZag` object's reference.
Settings
A structure for objects that store calculation and display properties for `ZigZag` instances.
Fields:
devThreshold (series float): The minimum percentage deviation from a previous pivot point required to change the Zig Zag's direction.
depth (series int): The number of bars required for pivot point detection.
lineColorUp (series color): The color of each line in the Zig Zag drawing that connects pivot highs.
lineColorDown (series color): The color of each line in the Zig Zag drawing that connects pivot lows.
textUpColor (series color): The color of the text in each label that shows a pivot high's price and volume.
textDownColor (series color): The color of the text in each label that shows a pivot low's price and volume.
lineWidth (series int): The width of the Zig Zag lines.
extendLast (series bool): Specifies whether the Zig Zag drawing includes a line connecting the most recent pivot point to the latest bar's `close`.
displayReversalPrice (series bool): Specifies whether the Zig Zag drawing shows pivot prices in its labels.
displayCumulativeVolume (series bool): Specifies whether the Zig Zag drawing shows the cumulative volume between pivot points in its labels.
displayReversalPriceChange (series bool): Specifies whether the Zig Zag drawing shows the reversal amount from the previous pivot point in each label.
differencePriceMode (series string): The reversal amount display mode. Possible values: `"Absolute"` for price change or `"Percent"` for percentage change.
draw (series bool): Specifies whether the Zig Zag drawing displays its lines and labels.
allowZigZagOnOneBar (series bool): Specifies whether the Zig Zag calculation can register a pivot high *and* pivot low on the same bar.
drawSupportResistance (series bool): Specifies whether the Zig Zag drawing includes support and resistance lines.
supportResistanceOffset (series int): The number of bars to extend the support and resistance lines from the last pivot point.
supportResistanceWidth (series int): The width of the support and resistance lines.
supportColor (series color): The color of the support lines.
resistanceColor (series color): The color of the resistance lines.
supportResistanceZoneWidth (series int): The width of the support and resistance zones.
drawSupportResistanceZone (series bool): Specifies whether the Zig Zag drawing includes support and resistance zones.
supportZoneColor (series color): The color of the support zone.
resistanceZoneColor (series color): The color of the resistance zone.
supportResistanceExtend (series bool): Specifies whether the support and resistance lines extend to the right of the chart.
overlay (series bool): Specifies whether the Zig Zag drawing appears on the main chart or in a separate pane.
zigZagLineStyle (series string): The line style of the Zig Zag lines. Possible values: `line.style_solid`, `line.style_dotted`, `line.style_dashed`, `line.style_arrow_left`, `line.style_arrow_right`, or `line.style_arrow_both`.
supportResistanceLineStyle (series string): The line style of the support and resistance lines. Possible values: `line.style_solid`, `line.style_dotted`, `line.style_dashed`, `line.style_arrow_left`, `line.style_arrow_right`, or `line.style_arrow_both`.
Pivot
A structure for objects that store chart point references, drawing references, and volume information for `ZigZag` instances.
Fields:
ln (series line): References a `line` object that connects the coordinates from the `start` and `end` chart points.
lb (series label): References a `label` object that displays pivot data at the `end` chart point's coordinates.
isHigh (series bool): Specifies whether the pivot at the `end` chart point's coordinates is a pivot high.
vol (series float): The cumulative volume across the bars between the `start` and `end` chart points.
start (chart.point): References a `chart.point` object containing the coordinates of the previous pivot point.
end (chart.point): References a `chart.point` object containing the coordinates of the current pivot point.
supportResistance (series line)
supportResistanceZone (series line)
ZigZag
A structure for objects that maintain Zig Zag drawing settings, pivots, and cumulative volume data.
Fields:
settings (Settings): References a `Settings` object that specifies the Zig Zag drawing's calculation and display properties.
pivots (array<Pivot>): References an array of `Pivot` objects that store pivot point, drawing, and volume information.
sumVol (series float): The cumulative volume across bars covered by the latest `Pivot` object's line segment.
extend (Pivot): References a `Pivot` object that projects a line from the last confirmed pivot point to the current bar's `close`.
Pine kitaplığı
Gerçek TradingView ruhuyla, yazar bu Pine kodunu açık kaynaklı bir kütüphane olarak yayınladı, böylece topluluğumuzdaki diğer Pine programcıları onu yeniden kullanabilir. Yazara saygı! Bu kütüphaneyi özel olarak veya diğer açık kaynaklı yayınlarda kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Site Kuralları tarafından yönetilmektedir.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Pine kitaplığı
Gerçek TradingView ruhuyla, yazar bu Pine kodunu açık kaynaklı bir kütüphane olarak yayınladı, böylece topluluğumuzdaki diğer Pine programcıları onu yeniden kullanabilir. Yazara saygı! Bu kütüphaneyi özel olarak veya diğer açık kaynaklı yayınlarda kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Site Kuralları tarafından yönetilmektedir.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.