PINE LIBRARY
Updated reversalchartpatterns

Library "reversalchartpatterns"
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: array<ReversalChartPattern>
Parameters:
this (array<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, allowedPatterns, offset)
Scans zigzag for ReversalChartPattern occurences
Namespace types: zg.Zigzag
Parameters:
zigzag (Zigzag type from Trendoscope/Zigzag/11): ZigzagTypes.Zigzag object having array of zigzag pivots and other information on each pivots
patterns (array<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 (array<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 Trendoscope/Zigzag/11): 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
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 (array<Line> type from Trendoscope/Drawing/2): array of Line objects representing pattern
entry (Line type from Trendoscope/Drawing/2): Entry price Line
targets (array<Line> type from Trendoscope/Drawing/2)
stop (Line type from Trendoscope/Drawing/2): Stop price Line
patternLabel (Label type from Trendoscope/Drawing/2)
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 (array<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
ReversalChartPattern
Reversal Chart Pattern master type which holds the pattern components, drawings and trade details
Fields:
pivots (array<Pivot> type from Trendoscope/Zigzag/11): 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 Trendoscope/TradeTracker/1): TradeTracker.Trade object holding trade components
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: array<ReversalChartPattern>
Parameters:
this (array<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, allowedPatterns, offset)
Scans zigzag for ReversalChartPattern occurences
Namespace types: zg.Zigzag
Parameters:
zigzag (Zigzag type from Trendoscope/Zigzag/11): ZigzagTypes.Zigzag object having array of zigzag pivots and other information on each pivots
patterns (array<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 (array<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 Trendoscope/Zigzag/11): 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
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 (array<Line> type from Trendoscope/Drawing/2): array of Line objects representing pattern
entry (Line type from Trendoscope/Drawing/2): Entry price Line
targets (array<Line> type from Trendoscope/Drawing/2)
stop (Line type from Trendoscope/Drawing/2): Stop price Line
patternLabel (Label type from Trendoscope/Drawing/2)
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 (array<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
ReversalChartPattern
Reversal Chart Pattern master type which holds the pattern components, drawings and trade details
Fields:
pivots (array<Pivot> type from Trendoscope/Zigzag/11): 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 Trendoscope/TradeTracker/1): TradeTracker.Trade object holding trade components
Release Notes
v2Updated:
method createPattern(zigzag, patternType, lineWidth, patternColor, properties, offset)
Create Pattern from ZigzagTypes.Zigzag object
Namespace types: zg.Zigzag
Parameters:
zigzag (Zigzag type from Trendoscope/Zigzag/11): 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
lineWidth (int): Pattern line width
patternColor (color): Color in which the patterns are drawn
properties (ReversalChartTradeProperties): ReversalChartPatternProperties used for the pattern scan and drawing
offset (int): Zigzag offset to be used for scanning patterns
Returns: ReversalChartPattern object created
ReversalChartPattern
Reversal Chart Pattern master type which holds the pattern components, drawings and trade details
Fields:
pivots (array<Pivot> type from Trendoscope/Zigzag/11): 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
lineWidth (series int): Pattern line width
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 Trendoscope/TradeTracker/1): TradeTracker.Trade object holding trade components
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Trial - trendoscope.io/trial
Subscribe - trendoscope.io/pricing
Blog - docs.trendoscope.io
Subscribe - trendoscope.io/pricing
Blog - docs.trendoscope.io
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Pine library
In true TradingView spirit, the author has published this Pine code as an open-source library so that other Pine programmers from our community can reuse it. Cheers to the author! You may use this library privately or in other open-source publications, but reuse of this code in publications is governed by House Rules.
Trial - trendoscope.io/trial
Subscribe - trendoscope.io/pricing
Blog - docs.trendoscope.io
Subscribe - trendoscope.io/pricing
Blog - docs.trendoscope.io
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.