PINE LIBRARY
zigzag

Library "zigzag"
Library dedicated to zigzags and related indicators
zigzag(length, numberOfPivots, useAlternativeSource, source, oscillatorSource, oscillatorHighSource, oscillatorLowSource, directionBias, divergenceOption)
zigzag: Calculates zigzag pivots and generates an array
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
useAlternativeSource (simple bool): : If set uses the source for genrating zigzag. Default is false
source (float): : Alternative source used only if useAlternativeSource is set to true. Default is close
oscillatorSource (float): : Oscillator source for calculating divergence
oscillatorHighSource (float)
oscillatorLowSource (float)
directionBias (int): : Direction bias for calculating divergence
divergenceOption (int): : 1 - hidden/regular, 2 - regular, 3 - hidden
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
newPivot : Returns true if new pivot created
doublePivot : Returns true if two new pivots are created on same bar (Happens in case of candles with long wicks and shorter zigzag lengths)
czigzag(length, numberOfPivots, highSource, lowSource, oscillatorHighSource, oscillatorLowSource, directionBias, divergenceOption)
czigzag: Calculates zigzag pivots and generates an array based on custom high and low source
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
highSource (float): : High Source for prices to calculate zigzag.
lowSource (float): : Low source for prices to calculate zigzag.
oscillatorHighSource (float): : Oscillator high source for calculating divergence
oscillatorLowSource (float): : Oscillator high source for calculating divergence
directionBias (int): : Direction bias for calculating divergence
divergenceOption (int): : 1 - hidden/regular, 2 - regular, 3 - hidden
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzagdoubledivergence : Array of double divergence sentiment at each pivot
newPivot : Returns true if new pivot created
doublePivot : Returns true if two new pivots are created on same bar (Happens in case of candles with long wicks and shorter zigzag lengths)
drawczigzag(length, numberOfPivots, highSource, lowSource, oscillatorHighSource, oscillatorLowSource, directionBias, showHighLow, showRatios, showDivergence, showDoubleDivergence, showIndicator, linecolor, linewidth, linestyle)
drawczigzag: Calculates and draws zigzag pivots and generates an array based on custom high and low source
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
highSource (float): : High Source for prices to calculate zigzag.
lowSource (float): : Low source for prices to calculate zigzag.
oscillatorHighSource (float): : Oscillator high source for calculating divergence
oscillatorLowSource (float): : Oscillator high source for calculating divergence
directionBias (int): : Direction bias for calculating divergence
showHighLow (simple bool): : show highlow label
showRatios (simple bool): : show retracement ratios
showDivergence (simple bool): : Show divergence on label (Only works if divergence data is available - that is if we pass valid oscillatorSource and directionBias input)
showDoubleDivergence (simple bool): : Show double divergence label
showIndicator (simple bool)
linecolor (color): : zigzag line color
linewidth (int): : zigzag line width
linestyle (string): : zigzag line style
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzagdoubledivergence : Array of double divergence sentiment at each pivot
zigzaglines : Returns array of zigzag lines
zigzaglabels : Returns array of zigzag labels
drawczigzag2(length, numberOfPivots, highSource, lowSource, oscillatorHighSource, oscillatorLowSource, directionBias, showHighLow, showRatios, showDivergence, showDoubleDivergence, showIndicator, linecolor, linewidth, linestyle)
drawczigzag2: Same as drawczigzag. But, returns newPivot and doublePivot bools as well.
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
highSource (float): : High Source for prices to calculate zigzag.
lowSource (float): : Low source for prices to calculate zigzag.
oscillatorHighSource (float): : Oscillator high source for calculating divergence
oscillatorLowSource (float): : Oscillator high source for calculating divergence
directionBias (int): : Direction bias for calculating divergence
showHighLow (simple bool): : show highlow label
showRatios (simple bool): : show retracement ratios
showDivergence (simple bool): : Show divergence on label (Only works if divergence data is available - that is if we pass valid oscillatorSource and directionBias input)
showDoubleDivergence (simple bool): : Show double divergence label
showIndicator (simple bool)
linecolor (color): : zigzag line color
linewidth (int): : zigzag line width
linestyle (string): : zigzag line style
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzagdoubledivergence : Array of double divergence sentiment at each pivot
zigzaglines : Returns array of zigzag lines
zigzaglabels : Returns array of zigzag labels
drawzigzag(length, numberOfPivots, useAlternativeSource, source, linecolor, linewidth, linestyle, oscillatorSource, oscillatorHighSource, oscillatorLowSource, directionBias, showHighLow, showRatios, showDivergence)
drawzigzag: Calculates and draws zigzag pivots
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
useAlternativeSource (simple bool)
source (float): : Alternative source used only if useAlternativeSource is set to true. Default is close
linecolor (color): : zigzag line color
linewidth (int): : zigzag line width
linestyle (string): : zigzag line style
oscillatorSource (float): : Oscillator source for calculating divergence
oscillatorHighSource (float)
oscillatorLowSource (float)
directionBias (int): : Direction bias for calculating divergence
showHighLow (simple bool): : show highlow label
showRatios (simple bool): : show retracement ratios
showDivergence (simple bool): : Show divergence on label (Only works if divergence data is available - that is if we pass valid oscillatorSource and directionBias input)
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzaglines : Returns array of zigzag lines
zigzaglabels : Returns array of zigzag labels
Library dedicated to zigzags and related indicators
zigzag(length, numberOfPivots, useAlternativeSource, source, oscillatorSource, oscillatorHighSource, oscillatorLowSource, directionBias, divergenceOption)
zigzag: Calculates zigzag pivots and generates an array
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
useAlternativeSource (simple bool): : If set uses the source for genrating zigzag. Default is false
source (float): : Alternative source used only if useAlternativeSource is set to true. Default is close
oscillatorSource (float): : Oscillator source for calculating divergence
oscillatorHighSource (float)
oscillatorLowSource (float)
directionBias (int): : Direction bias for calculating divergence
divergenceOption (int): : 1 - hidden/regular, 2 - regular, 3 - hidden
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
newPivot : Returns true if new pivot created
doublePivot : Returns true if two new pivots are created on same bar (Happens in case of candles with long wicks and shorter zigzag lengths)
czigzag(length, numberOfPivots, highSource, lowSource, oscillatorHighSource, oscillatorLowSource, directionBias, divergenceOption)
czigzag: Calculates zigzag pivots and generates an array based on custom high and low source
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
highSource (float): : High Source for prices to calculate zigzag.
lowSource (float): : Low source for prices to calculate zigzag.
oscillatorHighSource (float): : Oscillator high source for calculating divergence
oscillatorLowSource (float): : Oscillator high source for calculating divergence
directionBias (int): : Direction bias for calculating divergence
divergenceOption (int): : 1 - hidden/regular, 2 - regular, 3 - hidden
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzagdoubledivergence : Array of double divergence sentiment at each pivot
newPivot : Returns true if new pivot created
doublePivot : Returns true if two new pivots are created on same bar (Happens in case of candles with long wicks and shorter zigzag lengths)
drawczigzag(length, numberOfPivots, highSource, lowSource, oscillatorHighSource, oscillatorLowSource, directionBias, showHighLow, showRatios, showDivergence, showDoubleDivergence, showIndicator, linecolor, linewidth, linestyle)
drawczigzag: Calculates and draws zigzag pivots and generates an array based on custom high and low source
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
highSource (float): : High Source for prices to calculate zigzag.
lowSource (float): : Low source for prices to calculate zigzag.
oscillatorHighSource (float): : Oscillator high source for calculating divergence
oscillatorLowSource (float): : Oscillator high source for calculating divergence
directionBias (int): : Direction bias for calculating divergence
showHighLow (simple bool): : show highlow label
showRatios (simple bool): : show retracement ratios
showDivergence (simple bool): : Show divergence on label (Only works if divergence data is available - that is if we pass valid oscillatorSource and directionBias input)
showDoubleDivergence (simple bool): : Show double divergence label
showIndicator (simple bool)
linecolor (color): : zigzag line color
linewidth (int): : zigzag line width
linestyle (string): : zigzag line style
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzagdoubledivergence : Array of double divergence sentiment at each pivot
zigzaglines : Returns array of zigzag lines
zigzaglabels : Returns array of zigzag labels
drawczigzag2(length, numberOfPivots, highSource, lowSource, oscillatorHighSource, oscillatorLowSource, directionBias, showHighLow, showRatios, showDivergence, showDoubleDivergence, showIndicator, linecolor, linewidth, linestyle)
drawczigzag2: Same as drawczigzag. But, returns newPivot and doublePivot bools as well.
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
highSource (float): : High Source for prices to calculate zigzag.
lowSource (float): : Low source for prices to calculate zigzag.
oscillatorHighSource (float): : Oscillator high source for calculating divergence
oscillatorLowSource (float): : Oscillator high source for calculating divergence
directionBias (int): : Direction bias for calculating divergence
showHighLow (simple bool): : show highlow label
showRatios (simple bool): : show retracement ratios
showDivergence (simple bool): : Show divergence on label (Only works if divergence data is available - that is if we pass valid oscillatorSource and directionBias input)
showDoubleDivergence (simple bool): : Show double divergence label
showIndicator (simple bool)
linecolor (color): : zigzag line color
linewidth (int): : zigzag line width
linestyle (string): : zigzag line style
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzagdoubledivergence : Array of double divergence sentiment at each pivot
zigzaglines : Returns array of zigzag lines
zigzaglabels : Returns array of zigzag labels
drawzigzag(length, numberOfPivots, useAlternativeSource, source, linecolor, linewidth, linestyle, oscillatorSource, oscillatorHighSource, oscillatorLowSource, directionBias, showHighLow, showRatios, showDivergence)
drawzigzag: Calculates and draws zigzag pivots
Parameters:
length (int): : Zigzag Length
numberOfPivots (simple int): : Max number of pivots to return in the array. Default is 20
useAlternativeSource (simple bool)
source (float): : Alternative source used only if useAlternativeSource is set to true. Default is close
linecolor (color): : zigzag line color
linewidth (int): : zigzag line width
linestyle (string): : zigzag line style
oscillatorSource (float): : Oscillator source for calculating divergence
oscillatorHighSource (float)
oscillatorLowSource (float)
directionBias (int): : Direction bias for calculating divergence
showHighLow (simple bool): : show highlow label
showRatios (simple bool): : show retracement ratios
showDivergence (simple bool): : Show divergence on label (Only works if divergence data is available - that is if we pass valid oscillatorSource and directionBias input)
Returns: zigzagpivots : Array containing zigzag pivots
zigzagpivotbars : Array containing zigzag pivot bars
zigzagpivotdirs : Array containing zigzag pivot directions (Lower High : 1, Higher High : 2, Lower Low : -2 and Higher Low : -1)
zigzagpivotratios : Array containing zigzag retracement ratios for each pivot
zigzagoscillators : Array of oscillator values at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagoscillatordirs: Array of oscillator directions (HH, HL, LH, LL) at pivots. Will have valid values only if valid oscillatorSource is provided as per input.
zigzagtrendbias : Array of trend bias at pivots. Will have valid value only if directionBias series is sent in input parameters
zigzagdivergence : Array of divergence sentiment at each pivot. Will have valid values only if oscillatorSource and directionBias inputs are provided
zigzaglines : Returns array of zigzag lines
zigzaglabels : Returns array of zigzag labels
ספריית Pine
ברוח TradingView אמיתית, המחבר פרסם את קוד Pine זה כספריית קוד פתוח כך שמתכנתי Pine אחרים מהקהילה שלנו יוכלו לעשות בו שימוש חוזר. כל הכבוד למחבר! אתה יכול להשתמש בספרייה זו באופן פרטי או בפרסומי קוד פתוח אחרים, אך השימוש החוזר בקוד זה בפרסומים כפוף לכללי הבית.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.
ספריית Pine
ברוח TradingView אמיתית, המחבר פרסם את קוד Pine זה כספריית קוד פתוח כך שמתכנתי Pine אחרים מהקהילה שלנו יוכלו לעשות בו שימוש חוזר. כל הכבוד למחבר! אתה יכול להשתמש בספרייה זו באופן פרטי או בפרסומי קוד פתוח אחרים, אך השימוש החוזר בקוד זה בפרסומים כפוף לכללי הבית.
כתב ויתור
המידע והפרסומים אינם אמורים להיות, ואינם מהווים, עצות פיננסיות, השקעות, מסחר או סוגים אחרים של עצות או המלצות שסופקו או מאושרים על ידי TradingView. קרא עוד בתנאים וההגבלות.