PINE LIBRARY

abstractchartpatterns

ที่อัปเดต:
Library "abstractchartpatterns"
Library having abstract types and methods for chart pattern implementations

checkBarRatio(p1, p2, p3, properties)
  checks if three zigzag pivot points are having uniform bar ratios
  Parameters:
    p1 (chart.point): First pivot point
    p2 (chart.point): Second pivot point
    p3 (chart.point): Third pivot point
    properties (ScanProperties)
  Returns: true if points are having uniform bar ratio

getRatioDiff(p1, p2, p3)
  gets ratio difference between 3 pivot combinations
  Parameters:
    p1 (chart.point)
    p2 (chart.point)
    p3 (chart.point)
  Returns: returns the ratio difference between pivot2/pivot1 ratio and pivot3/pivot2 ratio

method inspect(points, stratingBar, endingBar, direction, ohlcArray)
  Creates a trend line between 2 or 3 points and validates and selects best combination
  Namespace types: chart.point[]
  Parameters:
    points (chart.point[]): Array of chart.point objects used for drawing trend line
    stratingBar (int): starting bar of the trend line
    endingBar (int): ending bar of the trend line
    direction (float): direction of the last pivot. Tells whether the line is joining upper pivots or the lower pivots
    ohlcArray (OHLC[] type from Trendoscope/ohlc/1): Array of OHLC values
  Returns: boolean flag indicating if the trend line is valid and the trend line object as tuple

method draw(this)
  draws pattern on the chart
  Namespace types: Pattern
  Parameters:
    this (Pattern): Pattern object that needs to be drawn
  Returns: Current Pattern object

method erase(this)
  erase the given pattern on the chart
  Namespace types: Pattern
  Parameters:
    this (Pattern): Pattern object that needs to be erased
  Returns: Current Pattern object

method push(this, p, maxItems)
  push Pattern object to the array by keeping maxItems limit
  Namespace types: Pattern[]
  Parameters:
    this (Pattern[]): array of Pattern objects
    p (Pattern): Pattern object to be added to array
@oaram maxItems Max number of items the array can hold
    maxItems (int)
  Returns: Current Pattern array

method deepcopy(this)
  Perform deep copy of a chart point array
  Namespace types: chart.point[]
  Parameters:
    this (chart.point[]): array of chart.point objects
  Returns: deep copy array

DrawingProperties
  Object containing properties for pattern drawing
  Fields:
    patternLineWidth (series int): Line width of the pattern trend lines
    showZigzag (series bool): show zigzag associated with pattern
    zigzagLineWidth (series int): line width of the zigzag lines. Used only when showZigzag is set to true
    zigzagLineColor (series color): color of the zigzag lines. Used only when showZigzag is set to true
    showPatternLabel (series bool): display pattern label containing the name
    patternLabelSize (series string): size of the pattern label. Used only when showPatternLabel is set to true
    showPivotLabels (series bool): Display pivot labels of the patterns marking 1-6
    pivotLabelSize (series string): size of the pivot label. Used only when showPivotLabels is set to true
    pivotLabelColor (series color): color of the pivot label outline. chart.bg_color or chart.fg_color are the appropriate values.
    deleteOnPop (series bool): delete the pattern when popping out from the array of Patterns.

Pattern
  Object containing Individual Pattern data
  Fields:
    points (chart.point[])
    originalPoints (chart.point[])
    trendLine1 (Line type from Trendoscope/LineWrapper/1): First trend line joining pivots 1, 3, 5
    trendLine2 (Line type from Trendoscope/LineWrapper/1): Second trend line joining pivots 2, 4 (, 6)
    properties (DrawingProperties): DrawingProperties Object carrying common properties
    patternColor (series color): Individual pattern color. Lines and labels will be using this color.
    ratioDiff (series float): Difference between trendLine1 and trendLine2 ratios
    zigzagLine (series polyline): Internal zigzag line drawing Object
    pivotLabels (label[]): array containning Pivot labels
    patternLabel (series label): pattern label Object
    patternType (series int): integer representing the pattern type
    patternName (series string): Type of pattern in string

ScanProperties
  Object containing properties for pattern scanning
  Fields:
    offset (series int): Zigzag pivot offset. Set it to 1 for non repainting scan.
    numberOfPivots (series int): Number of pivots to be used in pattern search. Can be either 5 or 6
    errorRatio (series float): Error Threshold to be considered for comparing the slope of lines
    flatRatio (series float): Retracement ratio threshold used to determine if the lines are flat
    checkBarRatio (series bool): Also check bar ratio are within the limits while scanning the patterns
    barRatioLimit (series float): Bar ratio limit used for checking the bars. Used only when checkBarRatio is set to true
    avoidOverlap (series bool): avoid overlapping patterns.
    allowedPatterns (bool[]): array of bool encoding the allowed pattern types.
    allowedLastPivotDirections (int[]): array of int representing allowed last pivot direction for each pattern types
    themeColors (color[]): color array of themes to be used.
เอกสารเผยแพร่
v2

Updated:
Pattern
  Object containing Individual Pattern data
  Fields:
    dir (series int): direction of the last pivot
    points (chart.point[])
    originalPoints (chart.point[])
    trendLine1 (Line type from Trendoscope/LineWrapper/1): First trend line joining pivots 1, 3, 5
    trendLine2 (Line type from Trendoscope/LineWrapper/1): Second trend line joining pivots 2, 4 (, 6)
    properties (DrawingProperties): DrawingProperties Object carrying common properties
    patternColor (series color): Individual pattern color. Lines and labels will be using this color.
    ratioDiff (series float): Difference between trendLine1 and trendLine2 ratios
    zigzagLine (series polyline): Internal zigzag line drawing Object
    pivotLabels (label[]): array containning Pivot labels
    patternLabel (series label): pattern label Object
    patternType (series int): integer representing the pattern type
    patternName (series string): Type of pattern in string
เอกสารเผยแพร่
v3

Updated:
method inspect(points, stratingBar, endingBar, direction, ohlcArray)
  Creates a trend line between 2 or 3 points and validates and selects best combination
  Namespace types: chart.point[]
  Parameters:
    points (chart.point[]): Array of chart.point objects used for drawing trend line
    stratingBar (int): starting bar of the trend line
    endingBar (int): ending bar of the trend line
    direction (float): direction of the last pivot. Tells whether the line is joining upper pivots or the lower pivots
    ohlcArray (OHLC[] type from Trendoscope/ohlc/2): Array of OHLC values
  Returns: boolean flag indicating if the trend line is valid and the trend line object as tuple
เอกสารเผยแพร่
v4

Updated:
Pattern
  Object containing Individual Pattern data
  Fields:
    dir (series int): direction of the last pivot
    points (chart.point[]): array of Zigzag Pivot points
    trendLine1 (Line type from Trendoscope/LineWrapper/1): First trend line joining pivots 1, 3, 5
    trendLine2 (Line type from Trendoscope/LineWrapper/1): Second trend line joining pivots 2, 4 (, 6)
    properties (DrawingProperties): DrawingProperties Object carrying common properties
    patternColor (series color): Individual pattern color. Lines and labels will be using this color.
    ratioDiff (series float): Difference between trendLine1 and trendLine2 ratios
    zigzagLine (series polyline): Internal zigzag line drawing Object
    pivotLabels (label[]): array containning Pivot labels
    patternLabel (series label): pattern label Object
    patternType (series int): integer representing the pattern type
    patternName (series string): Type of pattern in string
เอกสารเผยแพร่
v5

Updated:
method inspect(points, stratingBar, endingBar, direction, ohlcArray)
  Creates a trend line between 2 or 3 points and validates and selects best combination
  Namespace types: chart.point[]
  Parameters:
    points (chart.point[]): Array of chart.point objects used for drawing trend line
    stratingBar (int): starting bar of the trend line
    endingBar (int): ending bar of the trend line
    direction (float): direction of the last pivot. Tells whether the line is joining upper pivots or the lower pivots
    ohlcArray (OHLC[] type from Trendoscope/ohlc/1): Array of OHLC values
  Returns: boolean flag indicating if the trend line is valid and the trend line object as tuple
เอกสารเผยแพร่
v6

Added:
SizeFilters
  Object containing properties for pattern size filters
  Fields:
    filterByBar (series bool): If set filter the patterns by the bar range
    minPatternBars (series int): Used only when filterByBar is set to true. Minimum bars range for pattern size
    maxPatternBars (series int): Used only when filterByBar is set to true. Maximum bars range for pattern size
    filterByPercent (series bool): Filters patterns by percent of price if set
    minPatternPercent (series int): Used only when filterByPercent is set. Minimum pattern size in terms of percent of price
    maxPatternPercent (series int): Used only when filterByPercent is set. Maximum pattern size in terms of percent of price
เอกสารเผยแพร่
v7

Added:
checkSize(filters, points)
  checks if the series of pivots are within the size filter
  Parameters:
    filters (SizeFilters): SizeFilters object containing size criteria to be matched
    points (array<chart.point>): list of pivot points
  Returns: true if matches the size filter, false otherwise

Updated:
ScanProperties
  Object containing properties for pattern scanning
  Fields:
    offset (series int): Zigzag pivot offset. Set it to 1 for non repainting scan.
    numberOfPivots (series int): Number of pivots to be used in pattern search. Can be either 5 or 6
    errorRatio (series float): Error Threshold to be considered for comparing the slope of lines
    flatRatio (series float): Retracement ratio threshold used to determine if the lines are flat
    checkBarRatio (series bool): Also check bar ratio are within the limits while scanning the patterns
    barRatioLimit (series float): Bar ratio limit used for checking the bars. Used only when checkBarRatio is set to true
    avoidOverlap (series bool): avoid overlapping patterns.
    allowedPatterns (array<bool>): array of bool encoding the allowed pattern types.
    allowedLastPivotDirections (array<int>): array of int representing allowed last pivot direction for each pattern types
    themeColors (array<color>): color array of themes to be used.
    filters (SizeFilters)
เอกสารเผยแพร่
v8
เอกสารเผยแพร่
v9

Updated:
method inspect(points, stratingBar, endingBar, direction, ohlcArray)
  Creates a trend line between 2 or 3 points and validates and selects best combination
  Namespace types: array<chart.point>
  Parameters:
    points (array<chart.point>): Array of chart.point objects used for drawing trend line
    stratingBar (int): starting bar of the trend line
    endingBar (int): ending bar of the trend line
    direction (float): direction of the last pivot. Tells whether the line is joining upper pivots or the lower pivots
    ohlcArray (array<OHLC> type from Trendoscope/ohlc/3): Array of OHLC values
  Returns: boolean flag indicating if the trend line is valid and the trend line object as tuple

Pattern
  Object containing Individual Pattern data
  Fields:
    dir (series int): direction of the last pivot
    points (array<chart.point>): array of Zigzag Pivot points
    trendLine1 (Line type from Trendoscope/LineWrapper/2): First trend line joining pivots 1, 3, 5
    trendLine2 (Line type from Trendoscope/LineWrapper/2): Second trend line joining pivots 2, 4 (, 6)
    properties (DrawingProperties): DrawingProperties Object carrying common properties
    patternColor (series color): Individual pattern color. Lines and labels will be using this color.
    ratioDiff (series float): Difference between trendLine1 and trendLine2 ratios
    zigzagLine (series polyline): Internal zigzag line drawing Object
    pivotLabels (array<label>): array containning Pivot labels
    patternLabel (series label): pattern label Object
    patternType (series int): integer representing the pattern type
    patternName (series string): Type of pattern in string
arrayshewhomustnotbenamedMarket Geometrytechindicatortrendoscope

ไลบรารีไพน์

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนได้เผยแพร่ Pine code นี้เป็นโอเพนซอร์ซไลบรารีเพื่อให้ Pine โปรแกรมเมอร์คนอื่นในชุมชนของเราสามารถนำไปใช้ซ้ำได้ ต้องขอบคุณผู้เขียน! คุณสามารถใช้ไลบรารีนี้ในแบบส่วนตัวหรือในการเผยแพร่แบบโอเพนซอร์สอื่น ๆ แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน

คำจำกัดสิทธิ์ความรับผิดชอบ