PINE LIBRARY

ZigZag force

163
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)
  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.
  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.
    lineColor (series color): The color of each line in the Zig Zag drawing.
    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.

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.

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`.

Отказ от ответственности

Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.