Library "mZigzag"
Matrix implementation of zigzag to allow further possibilities.
Main advantage of this library over previous zigzag methods is that you can attach any number of indicator/oscillator information to zigzag
calculate(length, ohlc, indicatorHigh, indicatorLow, numberOfPivots) calculates zigzag and related information
Parameters:
length: is zigzag length
ohlc: array of OHLC values to be used for zigzag calculation
indicatorHigh: Array of indicator values calculated based on high price of OHLC
indicatorLow: Array of indicators values calculated based on low price of OHLC
numberOfPivots: Number of pivots to be returned
Returns: pivotMatrix Matrix containing zigzag pivots, pivot bars, direction, ratio, and indicators added via indicatorHigh/indicatorLow
newZG is true if a new pivot is added to array
doubleZG is true if last calculation returned two new pivots (Happens on extreme price change)
draw(length, ohlc, indicatorLabels, indicatorHigh, indicatorLow, numberOfPivots, lineColor, lineWidth, lineStyle, showHighLow, showRatios, showIndicators) draws zigzag and related information
Parameters:
length: is zigzag length
ohlc: array of OHLC values to be used for zigzag calculation
indicatorLabels: Array of name of indicators passed
indicatorHigh: Array of indicator values calculated based on high price of OHLC
indicatorLow: Array of indicators values calculated based on low price of OHLC
numberOfPivots: Number of pivots to be returned
lineColor: zigzag line color. set to blue by default
lineWidth: zigzag line width. set to 1 by default
lineStyle: zigzag line style. set to line.style_solid by default
showHighLow: show HH, HL, LH, LL labels
showRatios: show pivot retracement ratios from previous zigzag
showIndicators: show indicator values
Returns: pivotMatrix Matrix containing zigzag pivots, pivot bars, direction, ratio, and indicators added via indicatorHigh/indicatorLow
zigzaglines array of zigzag lines
zigzaglabels array of zigzag labels