PINE LIBRARY

ReversalChartPatternLibrary

已更新
Library "ReversalChartPatternLibrary"
User Defined Types and Methods for reversal chart patterns - Double Top, Double Bottom, Triple Top, Triple Bottom, Cup and Handle, Inverted Cup and Handle, Head and Shoulders, Inverse Head and Shoulders

method delete(this)
  Deletes the drawing components of ReversalChartPatternDrawing object
  Namespace types: ReversalChartPatternDrawing
  Parameters:
    this (ReversalChartPatternDrawing): ReversalChartPatternDrawing object
  Returns: current ReversalChartPatternDrawing object

method delete(this)
  Deletes the drawing components of ReversalChartPattern object. In turn calls the delete of ReversalChartPatternDrawing
  Namespace types: ReversalChartPattern
  Parameters:
    this (ReversalChartPattern): ReversalChartPattern object
  Returns: current ReversalChartPattern object

method lpush(this, obj, limit, deleteOld)
  Array push with limited number of items in the array. Old items are deleted when new one comes and exceeds the limit
  Namespace types: ReversalChartPattern[]
  Parameters:
    this (ReversalChartPattern[]): array<ReversalChartPattern> object
    obj (ReversalChartPattern): ReversalChartPattern object which need to be pushed to the array
    limit (int): max items on the array. Default is 10
    deleteOld (bool): If set to true, also deletes the drawing objects. If not, the drawing objects are kept but the pattern object is removed from array. Default is false.
  Returns: current ReversalChartPattern object

method draw(this)
  Draws the components of ReversalChartPatternDrawing
  Namespace types: ReversalChartPatternDrawing
  Parameters:
    this (ReversalChartPatternDrawing): ReversalChartPatternDrawing object
  Returns: current ReversalChartPatternDrawing object

method draw(this)
  Draws the components of ReversalChartPatternDrawing within the ReversalChartPattern object.
  Namespace types: ReversalChartPattern
  Parameters:
    this (ReversalChartPattern): ReversalChartPattern object
  Returns: current ReversalChartPattern object

method scan(zigzag, patterns, errorPercent, shoulderStart, shoulderEnd)
  Scans zigzag for ReversalChartPattern occurences
  Namespace types: zg.Zigzag
  Parameters:
    zigzag (Zigzag type from HeWhoMustNotBeNamed/ZigzagTypes/2): ZigzagTypes.Zigzag object having array of zigzag pivots and other information on each pivots
    patterns (ReversalChartPattern[]): Existing patterns array. Used for validating duplicates
    errorPercent (float): Error threshold for considering ratios. Default is 13
    shoulderStart (float): Starting range of shoulder ratio. Used for identifying shoulders, handles and necklines
    shoulderEnd (float): Ending range of shoulder ratio. Used for identifying shoulders, handles and necklines
  Returns: int pattern type

method createPattern(zigzag, patternType, patternColor, riskAdjustment)
  Create Pattern from ZigzagTypes.Zigzag object
  Namespace types: zg.Zigzag
  Parameters:
    zigzag (Zigzag type from HeWhoMustNotBeNamed/ZigzagTypes/2): ZigzagTypes.Zigzag object having array of zigzag pivots and other information on each pivots
    patternType (int): Type of pattern being created. 1 - Double Tap, 2 - Triple Tap, 3 - Cup and Handle, 4 - Head and Shoulders
    patternColor (color): Color in which the patterns are drawn
    riskAdjustment (float): Used for calculating stops
  Returns: ReversalChartPattern object created

method getName(this)
  get pattern name of ReversalChartPattern object
  Namespace types: ReversalChartPattern
  Parameters:
    this (ReversalChartPattern): ReversalChartPattern object
  Returns: string name of the pattern

method getDescription(this)
  get consolidated description of ReversalChartPattern object
  Namespace types: ReversalChartPattern
  Parameters:
    this (ReversalChartPattern): ReversalChartPattern object
  Returns: string consolidated description

method init(this)
  initializes the ReversalChartPattern object and creates sub object types
  Namespace types: ReversalChartPattern
  Parameters:
    this (ReversalChartPattern): ReversalChartPattern object
  Returns: ReversalChartPattern current object

ReversalChartPatternDrawing
  Type which holds the drawing objects for Reversal Chart Pattern Types
  Fields:
    patternLines (Line[] type from HeWhoMustNotBeNamed/DrawingTypes/1): array of Line objects representing pattern
    entry (Line type from HeWhoMustNotBeNamed/DrawingTypes/1): Entry price Line
    target (Line type from HeWhoMustNotBeNamed/DrawingTypes/1): Target price Line
    patternLabel (Label type from HeWhoMustNotBeNamed/DrawingTypes/1)

ReversalChartPattern
  Reversal Chart Pattern master type which holds the pattern components, drawings and trade details
  Fields:
    pivots (Pivot[] type from HeWhoMustNotBeNamed/ZigzagTypes/2): Array of Zigzag Pivots forming the pattern
    patternType (series int): Defines the main type of pattern 1 - Double Tap, 1 - Triple Tap, 3 - Cup and Handle, 4 - Head and Shoulders
    patternColor (series color): Color in which the pattern will be drawn on chart
    riskAdjustment (series float): Percentage adjustment of risk. Used for setting stops
    drawing (ReversalChartPatternDrawing): ReversalChartPatternDrawing object which holds the drawing components
    trade (Trade type from HeWhoMustNotBeNamed/TradeTracker/1): TradeTracker.Trade object holding trade components
發布通知
v2

Updated:
method scan(zigzag, patterns, errorPercent, shoulderStart, shoulderEnd)
  Scans zigzag for ReversalChartPattern occurences
  Namespace types: zg.Zigzag
  Parameters:
    zigzag (Zigzag type from HeWhoMustNotBeNamed/ZigzagTypes/4): ZigzagTypes.Zigzag object having array of zigzag pivots and other information on each pivots
    patterns (ReversalChartPattern[]): Existing patterns array. Used for validating duplicates
    errorPercent (float): Error threshold for considering ratios. Default is 13
    shoulderStart (float): Starting range of shoulder ratio. Used for identifying shoulders, handles and necklines
    shoulderEnd (float): Ending range of shoulder ratio. Used for identifying shoulders, handles and necklines
  Returns: int pattern type

method createPattern(zigzag, patternType, patternColor, riskAdjustment)
  Create Pattern from ZigzagTypes.Zigzag object
  Namespace types: zg.Zigzag
  Parameters:
    zigzag (Zigzag type from HeWhoMustNotBeNamed/ZigzagTypes/4): ZigzagTypes.Zigzag object having array of zigzag pivots and other information on each pivots
    patternType (int): Type of pattern being created. 1 - Double Tap, 2 - Triple Tap, 3 - Cup and Handle, 4 - Head and Shoulders
    patternColor (color): Color in which the patterns are drawn
    riskAdjustment (float): Used for calculating stops
  Returns: ReversalChartPattern object created

ReversalChartPattern
  Reversal Chart Pattern master type which holds the pattern components, drawings and trade details
  Fields:
    pivots (Pivot[] type from HeWhoMustNotBeNamed/ZigzagTypes/4): Array of Zigzag Pivots forming the pattern
    patternType (series int): Defines the main type of pattern 1 - Double Tap, 1 - Triple Tap, 3 - Cup and Handle, 4 - Head and Shoulders
    patternColor (series color): Color in which the pattern will be drawn on chart
    riskAdjustment (series float): Percentage adjustment of risk. Used for setting stops
    drawing (ReversalChartPatternDrawing): ReversalChartPatternDrawing object which holds the drawing components
    trade (Trade type from HeWhoMustNotBeNamed/TradeTracker/1): TradeTracker.Trade object holding trade components
發布通知
v3

Added:
ReversalChartTradeProperties
  Trade properties of ReversalChartPattern
  Fields:
    riskAdjustment (series float): Risk Adjustment for calculation of stop
    useFixedTarget (series bool): Boolean flag saying use fixed target type wherever possible. If fixed target type is not possible, then risk reward/fib ratios are used for calculation of targets
    variableTargetType (series int): Integer value which defines whether to use fib based targets or risk reward based targets. 1 - Risk Reward, 2 - Fib Ratios
    variableTargetRatios (float[]): Risk reward or Fib Ratios to be used for calculation of targets when fixed target is not possible or not enabled
    entryPivotForWm (series int): which Pivot should be considered as entry point for WM patterns. 0 refers to the latest breakout pivot where as 5 refers to initial pivot of the pattern

Updated:
method scan(zigzag, patterns, errorPercent, shoulderStart, shoulderEnd, allowedPatterns, offset)
  Scans zigzag for ReversalChartPattern occurences
  Namespace types: zg.Zigzag
  Parameters:
    zigzag (Zigzag type from HeWhoMustNotBeNamed/ZigzagTypes/5): ZigzagTypes.Zigzag object having array of zigzag pivots and other information on each pivots
    patterns (ReversalChartPattern[]): Existing patterns array. Used for validating duplicates
    errorPercent (float): Error threshold for considering ratios. Default is 13
    shoulderStart (float): Starting range of shoulder ratio. Used for identifying shoulders, handles and necklines
    shoulderEnd (float): Ending range of shoulder ratio. Used for identifying shoulders, handles and necklines
    allowedPatterns (int[]): array of int containing allowed pattern types
    offset (int): Offset of zigzag to consider only confirmed pivots
  Returns: int pattern type

method createPattern(zigzag, patternType, patternColor, properties, offset)
  Create Pattern from ZigzagTypes.Zigzag object
  Namespace types: zg.Zigzag
  Parameters:
    zigzag (Zigzag type from HeWhoMustNotBeNamed/ZigzagTypes/5): ZigzagTypes.Zigzag object having array of zigzag pivots and other information on each pivots
    patternType (int): Type of pattern being created. 1 - Double Tap, 2 - Triple Tap, 3 - Cup and Handle, 4 - Head and Shoulders
    patternColor (color): Color in which the patterns are drawn
    properties (ReversalChartTradeProperties)
    offset (int)
  Returns: ReversalChartPattern object created

ReversalChartPatternDrawing
  Type which holds the drawing objects for Reversal Chart Pattern Types
  Fields:
    patternLines (Line[] type from HeWhoMustNotBeNamed/DrawingTypes/2): array of Line objects representing pattern
    entry (Line type from HeWhoMustNotBeNamed/DrawingTypes/2): Entry price Line
    targets (Line[] type from HeWhoMustNotBeNamed/DrawingTypes/2)
    stop (Line type from HeWhoMustNotBeNamed/DrawingTypes/2): Stop price Line
    patternLabel (Label type from HeWhoMustNotBeNamed/DrawingTypes/2)

ReversalChartPattern
  Reversal Chart Pattern master type which holds the pattern components, drawings and trade details
  Fields:
    pivots (Pivot[] type from HeWhoMustNotBeNamed/ZigzagTypes/5): Array of Zigzag Pivots forming the pattern
    patternType (series int): Defines the main type of pattern 1 - Double Tap, 1 - Triple Tap, 3 - Cup and Handle, 4 - Head and Shoulders, 5- W/M Patterns, 6 - Full Trend, 7 - Half Trend
    patternColor (series color): Color in which the pattern will be drawn on chart
    properties (ReversalChartTradeProperties)
    drawing (ReversalChartPatternDrawing): ReversalChartPatternDrawing object which holds the drawing components
    trade (Trade type from HeWhoMustNotBeNamed/TradeTracker/1): TradeTracker.Trade object holding trade components
發布通知
v4

Few logical updates
arrayshewhomustnotbenamedMarket Geometrytechindicatortrendoscope

Pine腳本庫

在真正的TradingView精神中,作者將這段Pine程式碼發佈為開源程式庫,以便我們社群的其他Pine程式設計師可以重複使用它。請向作者致敬!您可以私下使用這個函式庫,或在其他開源出版品中使用,但在出版物中再次使用這段程式碼將受到網站規則的約束。

免責聲明