PINE LIBRARY

ZigZaglibrary

Library "ZigZaglibrary"

method lastPivot(this)
  Returns the last `Pivot` object from a `ZigZag` instance if it contains at
least one `Pivot`, and `na` otherwise.
Can be used as a function or method.
  Namespace types: ZigZag
  Parameters:
    this (ZigZag): (series ZigZag) A `ZigZag` object.
  Returns: (Pivot) The last `Pivot` object in the `ZigZag`.

method update(this)
  Updates a `ZigZag` objects with new pivots, volume, lines, and labels.
NOTE: This function must be called on every bar for accurate calculations.
Can be used as a function or method.
  Namespace types: ZigZag
  Parameters:
    this (ZigZag): (series ZigZag) A `ZigZag` object.
  Returns: (bool) `true` when a new pivot point is registered and the `ZigZag` is updated,
`false` otherwise.

newInstance(settings)
  Instantiates a new `ZigZag` object with optional `settings`.
If no `settings` are provided, creates a `ZigZag` object with default settings.
  Parameters:
    settings (Settings): (series Settings) A `Settings` object.
  Returns: (ZigZag) A new `ZigZag` instance.

Settings
  Provides calculation and display properties to `ZigZag` objects.
  Fields:
    devThreshold (series float): The minimum percentage deviation from a point before the `ZigZag` changes direction.
    depth (series int): The number of bars required for pivot detection.
    lineColor (series color): The color of each line drawn by the `ZigZag`.
    extendLast (series bool): A condition allowing a line to connect the most recent pivot with the current close.
    displayReversalPrice (series bool): A condition to display the pivot price in the pivot label.
    displayCumulativeVolume (series bool): A condition to display the cumulative volume for the pivot segment in the pivot label.
    displayReversalPriceChange (series bool): A condition to display the change in price or percent from the previous pivot in each pivot label.
    differencePriceMode (series string): The reversal change display mode. Options are "Absolute" or "Percent".
    draw (series bool): A condition to determine whether the `ZigZag` displays lines and labels.
    allowZigZagOnOneBar (series bool): A condition to allow double pivots i.e., when a large bar makes both a pivot high and a pivot low.

Pivot
  Represents a significant level that indicates directional movement or potential support and resistance.
  Fields:
    ln (series line): A `line` object connecting the `start` and `end` chart points.
    lb (series label): A `label` object to display pivot values.
    isHigh (series bool): A condition to determine whether the pivot is a pivot high.
    vol (series float): The cumulative volume for the pivot segment.
    start (chart.point): A `chart.point` object representing the coordinates of the previous point.
    end (chart.point): A `chart.point` object representing the coordinate of the current point.

ZigZag
  An object to maintain a Zig Zag's settings, pivots, and cumulative volume.
  Fields:
    settings (Settings): A `Settings` object to provide calculation and display properties.
    pivots (array<Pivot>): An array of `Pivot` objects.
    sumVol (series float): The volume sum for the current `Pivot` object's line segment.
    extend (Pivot): A `Pivot` object used to project a line from the last pivot point to the current bar.
alerts

Libreria Pine

In pieno spirito TradingView, l'autore ha pubblicato questo codice Pine come libreria open-source in modo che altri programmatori Pine della nostra comunità possano riutilizzarlo. Un saluto all'autore! È possibile utilizzare questa libreria privatamente o in altre pubblicazioni open-source, ma il riutilizzo di questo codice in una pubblicazione è regolato dal nostro Regolamento.

Declinazione di responsabilità