Trendoscope

Zigzag

Trendoscope Wizard 已更新   
Library "Zigzag"
Zigzag related user defined types. Depends on DrawingTypes library for basic types

method tostring(this, sortKeys, sortOrder, includeKeys)
  Converts ZigzagTypes/Pivot object to string representation
  Namespace types: Pivot
  Parameters:
    this (Pivot): ZigzagTypes/Pivot
    sortKeys (bool): If set to true, string output is sorted by keys.
    sortOrder (int): Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
    includeKeys (string): Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of ZigzagTypes/Pivot

method tostring(this, sortKeys, sortOrder, includeKeys)
  Converts Array of Pivot objects to string representation
  Namespace types: Pivot
  Parameters:
    this (Pivot): Pivot object array
    sortKeys (bool): If set to true, string output is sorted by keys.
    sortOrder (int): Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
    includeKeys (string): Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of Pivot object array

method tostring(this)
  Converts ZigzagFlags object to string representation
  Namespace types: ZigzagFlags
  Parameters:
    this (ZigzagFlags): ZigzagFlags object
  Returns: string representation of ZigzagFlags

method tostring(this, sortKeys, sortOrder, includeKeys)
  Converts ZigzagTypes/Zigzag object to string representation
  Namespace types: Zigzag
  Parameters:
    this (Zigzag): ZigzagTypes/Zigzagobject
    sortKeys (bool): If set to true, string output is sorted by keys.
    sortOrder (int): Applicable only if sortKeys is set to true. Positive number will sort them in ascending order whreas negative numer will sort them in descending order. Passing 0 will not sort the keys
    includeKeys (string): Array of string containing selective keys. Optional parmaeter. If not provided, all the keys are considered
  Returns: string representation of ZigzagTypes/Zigzag

method calculate(this, ohlc, indicators, indicatorNames)
  Calculate zigzag based on input values and indicator values
  Namespace types: Zigzag
  Parameters:
    this (Zigzag): Zigzag object
    ohlc (float): Array containing OHLC values. Can also have custom values for which zigzag to be calculated
    indicators (matrix<float>): Array of indicator values
    indicatorNames (string): Array of indicator names for which values are present. Size of indicators array should be equal to that of indicatorNames
  Returns: current Zigzag object

method calculate(this)
  Calculate zigzag based on properties embedded within Zigzag object
  Namespace types: Zigzag
  Parameters:
    this (Zigzag): Zigzag object
  Returns: current Zigzag object

method nextlevel(this)
  Calculate Next Level Zigzag based on the current calculated zigzag object
  Namespace types: Zigzag
  Parameters:
    this (Zigzag): Zigzag object
  Returns: Next Level Zigzag object

method clear(this)
  Clears zigzag drawings array
  Namespace types: ZigzagDrawing
  Parameters:
    this (ZigzagDrawing): array<ZigzagDrawing>
  Returns: void

method drawplain(this)
  draws fresh zigzag based on properties embedded in ZigzagDrawing object without trying to calculate
  Namespace types: ZigzagDrawing
  Parameters:
    this (ZigzagDrawing): ZigzagDrawing object
  Returns: ZigzagDrawing object

method drawfresh(this, ohlc, indicators, indicatorNames)
  draws fresh zigzag based on properties embedded in ZigzagDrawing object
  Namespace types: ZigzagDrawing
  Parameters:
    this (ZigzagDrawing): ZigzagDrawing object
    ohlc (float): values on which the zigzag needs to be calculated and drawn. If not set will use regular OHLC
    indicators (matrix<float>): Array of indicator values
    indicatorNames (string): Array of indicator names for which values are present. Size of indicators array should be equal to that of indicatorNames
  Returns: ZigzagDrawing object

method drawcontinuous(this, ohlc, indicators, indicatorNames)
  draws zigzag based on the zigzagmatrix input
  Namespace types: ZigzagDrawing
  Parameters:
    this (ZigzagDrawing): ZigzagDrawing object
    ohlc (float): values on which the zigzag needs to be calculated and drawn. If not set will use regular OHLC
    indicators (matrix<float>): Array of indicator values
    indicatorNames (string): Array of indicator names for which values are present. Size of indicators array should be equal to that of indicatorNames
  Returns:

method getPrices(pivots)
  Namespace types: Pivot
  Parameters:
    pivots (Pivot)

method getBars(pivots)
  Namespace types: Pivot
  Parameters:
    pivots (Pivot)

Indicator
  Indicator is collection of indicator values applied on high, low and close
  Fields:
    indicatorHigh (series float): Indicator Value applied on High
    indicatorLow (series float): Indicator Value applied on Low

PivotCandle
  PivotCandle represents data of the candle which forms either pivot High or pivot low or both
  Fields:
    _high (series float): High price of candle forming the pivot
    _low (series float): Low price of candle forming the pivot
    length (series int): Pivot length
    pHighBar (series int): represents number of bar back the pivot High occurred.
    pLowBar (series int): represents number of bar back the pivot Low occurred.
    pHigh (series float): Pivot High Price
    pLow (series float): Pivot Low Price
    indicators (Indicator): Array of Indicators - allows to add multiple

Pivot
  Pivot refers to zigzag pivot. Each pivot can contain various data
  Fields:
    point (chart.point): pivot point coordinates
    dir (series int): direction of the pivot. Valid values are 1, -1, 2, -2
    level (series int): is used for multi level zigzags. For single level, it will always be 0
    componentIndex (series int): is the lower level zigzag array index for given pivot. Used only in multi level Zigzag Pivots
    subComponents (series int): is the number of sub waves per each zigzag wave. Only applicable for multi level zigzags
    microComponents (series int): is the number of base zigzag components in a zigzag wave
    ratio (series float): Price Ratio based on previous two pivots
    sizeRatio (series float)
    subPivots (Pivot)
    indicatorNames (string): Names of the indicators applied on zigzag
    indicatorValues (float): Values of the indicators applied on zigzag
    indicatorRatios (float): Ratios of the indicators applied on zigzag based on previous 2 pivots

ZigzagFlags
  Flags required for drawing zigzag. Only used internally in zigzag calculation. Should not set the values explicitly
  Fields:
    newPivot (series bool): true if the calculation resulted in new pivot
    doublePivot (series bool): true if the calculation resulted in two pivots on same bar
    updateLastPivot (series bool): true if new pivot calculated replaces the old one.

Zigzag
  Zigzag object which contains whole zigzag calculation parameters and pivots
  Fields:
    length (series int): Zigzag length. Default value is 5
    numberOfPivots (series int): max number of pivots to hold in the calculation. Default value is 20
    offset (series int): Bar offset to be considered for calculation of zigzag. Default is 0 - which means calculation is done based on the latest bar.
    level (series int): Zigzag calculation level - used in multi level recursive zigzags
    zigzagPivots (Pivot): array<Pivot> which holds the last n pivots calculated.
    flags (ZigzagFlags): ZigzagFlags object which is required for continuous drawing of zigzag lines.

ZigzagObject
  Zigzag Drawing Object
  Fields:
    zigzagLine (series line): Line joining two pivots
    zigzagLabel (series label): Label which can be used for drawing the values, ratios, directions etc.

ZigzagProperties
  Object which holds properties of zigzag drawing. To be used along with ZigzagDrawing
  Fields:
    lineColor (series color): Zigzag line color. Default is color.blue
    lineWidth (series int): Zigzag line width. Default is 1
    lineStyle (series string): Zigzag line style. Default is line.style_solid.
    showLabel (series bool): If set, the drawing will show labels on each pivot. Default is false
    textColor (series color): Text color of the labels. Only applicable if showLabel is set to true.
    maxObjects (series int): Max number of zigzag lines to display. Default is 300
    xloc (series string): Time/Bar reference to be used for zigzag drawing. Default is Time - xloc.bar_time.

ZigzagDrawing
  Object which holds complete zigzag drawing objects and properties.
  Fields:
    zigzag (Zigzag): Zigzag object which holds the calculations.
    properties (ZigzagProperties): ZigzagProperties object which is used for setting the display styles of zigzag
    drawings (ZigzagObject): array<ZigzagObject> which contains lines and labels of zigzag drawing.
版本注释:
v2

Added:
method getPoints(this)
  Namespace types: Zigzag
  Parameters:
    this (Zigzag)

ZigzagDrawingPL
  Object which holds complete zigzag drawing objects and properties - polyline version
  Fields:
    zigzag (Zigzag): Zigzag object which holds the calculations.
    properties (ZigzagProperties): ZigzagProperties object which is used for setting the display styles of zigzag
    zigzagLabels (label)
    zigzagLine (series polyline): polyline object of zigzag lines

Updated:
method drawplain(this)
  draws fresh zigzag based on properties embedded in ZigzagDrawingPL object without trying to calculate
  Namespace types: ZigzagDrawingPL
  Parameters:
    this (ZigzagDrawingPL): ZigzagDrawingPL object
  Returns: ZigzagDrawingPL object

ZigzagProperties
  Object which holds properties of zigzag drawing. To be used along with ZigzagDrawing
  Fields:
    lineColor (series color): Zigzag line color. Default is color.blue
    lineWidth (series int): Zigzag line width. Default is 1
    lineStyle (series string): Zigzag line style. Default is line.style_solid.
    showLabel (series bool): If set, the drawing will show labels on each pivot. Default is false
    textColor (series color): Text color of the labels. Only applicable if showLabel is set to true.
    maxObjects (series int): Max number of zigzag lines to display. Default is 300
    xloc (series string): Time/Bar reference to be used for zigzag drawing. Default is Time - xloc.bar_time.
    curved (series bool): Boolean field to print curved zigzag - used only with polyline implementation
版本注释:
v3

Updated:
method tostring(this, sortKeys, sortOrder, includeKeys)
  Namespace types: Zigzag
  Parameters:
    this (Zigzag)
    sortKeys (bool)
    sortOrder (int)
    includeKeys (string)

method getPrices(pivots)
  Gets the array of prices from array of Pivots
  Namespace types: Pivot
  Parameters:
    pivots (Pivot): array array of Pivot objects
  Returns: array array of pivot prices

method getBars(pivots)
  Gets the array of bars from array of Pivots
  Namespace types: Pivot
  Parameters:
    pivots (Pivot): array array of Pivot objects
  Returns: array array of pivot bar indices
版本注释:
v4
版本注释:
v5

Updated:
method clear(this)
  Clears zigzag drawings array
  Namespace types: ZigzagDrawingPL
  Parameters:
    this (ZigzagDrawingPL): array
  Returns: void
版本注释:
v6
版本注释:
v7

Updated:
Pivot
  Pivot refers to zigzag pivot. Each pivot can contain various data
  Fields:
    point (chart.point): pivot point coordinates
    dir (series int): direction of the pivot. Valid values are 1, -1, 2, -2
    level (series int): is used for multi level zigzags. For single level, it will always be 0
    componentIndex (series int): is the lower level zigzag array index for given pivot. Used only in multi level Zigzag Pivots
    subComponents (series int): is the number of sub waves per each zigzag wave. Only applicable for multi level zigzags
    microComponents (series int): is the number of base zigzag components in a zigzag wave
    ratio (series float): Price Ratio based on previous two pivots
    sizeRatio (series float): Ratio of size beteen current zigzag wave and the last zigzag wave in the same direction.
    barRatio (series float): Bar Ratio based on previous two pivots
    subPivots (Pivot)
    indicatorNames (string): Names of the indicators applied on zigzag
    indicatorValues (float): Values of the indicators applied on zigzag
    indicatorRatios (float): Ratios of the indicators applied on zigzag based on previous 2 pivots

Pine脚本库

本着真正的TradingView精神,作者将此Pine代码以开源脚本库发布,以便我们社区的其他Pine程序员可以重用它。向作者致敬!您可以私下或在其他开源出版物中使用此库,但在出版物中重用此代码受网站规则约束。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想使用这个脚本库吗?

复制以下行并将其粘贴到您的脚本中。