ADXZigZagLibrary "ADXZigZag"
method lastPivot(this)
Returns the last Pivot of `this` ZigZag if there is at least one Pivot to return, 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 in the ZigZag.
update(this)
Updates `this` ZigZag object with new pivots, volume, lines, labels. NOTE: The function must be called on every bar for accurate calculations.
Can be used as a function or method.
Parameters:
this (ZigZag) : (series ZigZag) a ZigZag object.
Returns: (bool) true if a new Zig Zag line is found or the last Zig Zag line has changed.
newInstance(settings)
Instantiates a new ZigZag object with `settings`. If no settings are provided, a default ZigZag object is created.
Parameters:
settings (Settings) : (series Settings) A Settings object.
Returns: (ZigZag) A new ZigZag instance.
Settings
Provides calculation and display attributes to ZigZag objects.
Fields:
devThreshold (series float) : The minimum percentage deviation from a point before the ZigZag will change direction.
depth (series int) : The number of bars required for pivot detection.
lineColor (series color) : Line color.
extendLast (series bool) : Condition allowing a line to connect the most recent pivot with the current close.
displayReversalPrice (series bool) : Condition to display the pivot price in the pivot label.
displayCumulativeVolume (series bool) : Condition to display the cumulative volume for the pivot segment in the pivot label.
displayReversalPriceChange (series bool) : Condition to display the change in price or percent from the previous pivot in the pivot label.
differencePriceMode (series string) : Reversal change display mode. Options are "Absolute" or "Percent".
draw (series bool) : Condition to display lines and labels.
allowZigZagOnOneBar (series bool) : Condition to allow double pivots to occur ie. when a large bar makes both a pivot high and a pivot low.
Point
A coordinate containing bar, price, and time information.
Fields:
tm (series int) : A value in UNIX time.
price (series float) : A value on the Y axis (price).
barIndex (series int) : A `bar_index`.
Pivot
A level of significance used to determine directional movement or potential support and resistance.
Fields:
ln (series line) : A line object connecting the `start` and `end` Point objects.
lb (series label) : A label object to display pivot values.
isHigh (series bool) : A condition to determine if the pivot is a pivot high.
vol (series float) : Volume for the pivot segment.
start (Point) : The coordinate of the previous Point.
end (Point) : The coordinate of the current Point.
ZigZag
An object to maintain Zig Zag settings, pivots, and volume.
Fields:
settings (Settings) : Settings object to provide calculation and display attributes.
pivots (array) : An array of Pivot objects.
sumVol (series float) : The volume sum for the pivot segment.
extend (Pivot) : Pivot object used to project a line from the last pivot to the last bar.