PINE LIBRARY
Pattern

Library "Pattern"
Pattern object definitions and functions. Easily draw and keep track of patterns, legs, and points.
Supported pattern types:
Type Leg validation # legs
"xabcd" Direction 3 or 4 (point D not required)
"zigzag" Direction >= 2
"free" None >= 2
Summary of exported types and associated methods/functions:
type point A point on the chart (x,y)
draw_label() Draw a point label
erase_label() Erase a point label
type leg A pattern leg (i.e. point A to point B)
leg_init() Initialize/instantiate a leg
draw() Draw a leg
erase() Erase a leg
leg_getLineTerms() Get the slope and y-intercept of a leg
leg_getPrice() Get price (Y) at a given bar index (X) within a leg
type pattern A pattern (set of at least 2 connected legs)
pattern_init() Initialize/instantiate a pattern
draw() Draw a pattern
erase() Erase a pattern
*See bottom of the script for example usage*
erase_label(this)
Delete the point label
Parameters:
this (point): Point
Returns: Void
draw_label(this, position, clr, transp, txt_clr, txt, tooltip, size)
Draw the point label
Parameters:
this (point): Point
position (string)
clr (color)
transp (float)
txt_clr (color)
txt (string)
tooltip (string)
size (string)
Returns: line
leg_init(a, b, prev, next, line)
Initialize a pattern leg
Parameters:
a (point): Point A (required)
b (point): Point B (required)
prev (leg): Previous leg
next (leg): Next leg
line (line): Line
Returns: New instance of leg object
erase(this)
Delete the pattern leg
Parameters:
this (leg): Leg
Returns: Void
erase(this)
Delete the pattern lines
Parameters:
this (pattern): Pattern
Returns: Void
draw(this, clr, style, transp, width)
Draw the pattern leg
Parameters:
this (leg): Leg
clr (color): Color
style (string): Style ("solid", "dotted", "dashed", "arrowleft", "arrowright")
transp (float): Transparency
width (int): Width
Returns: line
draw(this, clr, style, transp, width)
Draw the pattern
Parameters:
this (pattern): Pattern
clr (color): Color
style (string): Style ("solid", "dotted", "dashed", "arrowleft", "arrowright")
transp (float): Transparency
width (int): Width
Returns: line[]
leg_getLineTerms(this)
Get the slope and y-intercept of a leg
Parameters:
this (leg): Leg
Returns: [slope, y-intercept]
leg_getPrice(this, index)
Get the price (Y) at a given bar index (X) within the leg
Parameters:
this (leg): Leg
index (int): Bar index
Returns: Price (float)
pattern_init(legs, tp, name, subType, pid)
Initialize a pattern object from a given set of legs
Parameters:
legs (array<leg>): Array of pattern legs (required)
tp (string): Pattern type ("zigzag", "xabcd", or "free". dft = "free")
name (string): Pattern name
subType (string): Pattern subtype
pid (string): Pattern Identifier string
Returns: New instance of pattern object, if one was successfully created
pattern_init(points, tp, name, subType, pid)
Initialize a pattern object from a given set of points
Parameters:
points (array<point>)
tp (string): Pattern type ("zigzag", "xabcd", or "free". dft = "free")
name (string): Pattern name
subType (string): Pattern subtype
pid (string): Pattern Identifier string
Returns: New instance of pattern object, if one was successfully created
point
A point on the chart (x,y)
Fields:
x (series int): Bar index (x coordinate)
y (series float)
label (series label)
leg
A pattern leg (point A to point B)
Fields:
a (point): Point A
b (point)
deltaX (series int)
deltaY (series float)
prev (leg)
next (leg)
retrace (series float)
line (series line)
pattern
A pattern (set of at least 2 connected legs)
Fields:
legs (array<leg>)
type (series string)
subType (series string)
name (series string)
pid (series string)
Pattern object definitions and functions. Easily draw and keep track of patterns, legs, and points.
Supported pattern types:
Type Leg validation # legs
"xabcd" Direction 3 or 4 (point D not required)
"zigzag" Direction >= 2
"free" None >= 2
Summary of exported types and associated methods/functions:
type point A point on the chart (x,y)
draw_label() Draw a point label
erase_label() Erase a point label
type leg A pattern leg (i.e. point A to point B)
leg_init() Initialize/instantiate a leg
draw() Draw a leg
erase() Erase a leg
leg_getLineTerms() Get the slope and y-intercept of a leg
leg_getPrice() Get price (Y) at a given bar index (X) within a leg
type pattern A pattern (set of at least 2 connected legs)
pattern_init() Initialize/instantiate a pattern
draw() Draw a pattern
erase() Erase a pattern
*See bottom of the script for example usage*
erase_label(this)
Delete the point label
Parameters:
this (point): Point
Returns: Void
draw_label(this, position, clr, transp, txt_clr, txt, tooltip, size)
Draw the point label
Parameters:
this (point): Point
position (string)
clr (color)
transp (float)
txt_clr (color)
txt (string)
tooltip (string)
size (string)
Returns: line
leg_init(a, b, prev, next, line)
Initialize a pattern leg
Parameters:
a (point): Point A (required)
b (point): Point B (required)
prev (leg): Previous leg
next (leg): Next leg
line (line): Line
Returns: New instance of leg object
erase(this)
Delete the pattern leg
Parameters:
this (leg): Leg
Returns: Void
erase(this)
Delete the pattern lines
Parameters:
this (pattern): Pattern
Returns: Void
draw(this, clr, style, transp, width)
Draw the pattern leg
Parameters:
this (leg): Leg
clr (color): Color
style (string): Style ("solid", "dotted", "dashed", "arrowleft", "arrowright")
transp (float): Transparency
width (int): Width
Returns: line
draw(this, clr, style, transp, width)
Draw the pattern
Parameters:
this (pattern): Pattern
clr (color): Color
style (string): Style ("solid", "dotted", "dashed", "arrowleft", "arrowright")
transp (float): Transparency
width (int): Width
Returns: line[]
leg_getLineTerms(this)
Get the slope and y-intercept of a leg
Parameters:
this (leg): Leg
Returns: [slope, y-intercept]
leg_getPrice(this, index)
Get the price (Y) at a given bar index (X) within the leg
Parameters:
this (leg): Leg
index (int): Bar index
Returns: Price (float)
pattern_init(legs, tp, name, subType, pid)
Initialize a pattern object from a given set of legs
Parameters:
legs (array<leg>): Array of pattern legs (required)
tp (string): Pattern type ("zigzag", "xabcd", or "free". dft = "free")
name (string): Pattern name
subType (string): Pattern subtype
pid (string): Pattern Identifier string
Returns: New instance of pattern object, if one was successfully created
pattern_init(points, tp, name, subType, pid)
Initialize a pattern object from a given set of points
Parameters:
points (array<point>)
tp (string): Pattern type ("zigzag", "xabcd", or "free". dft = "free")
name (string): Pattern name
subType (string): Pattern subtype
pid (string): Pattern Identifier string
Returns: New instance of pattern object, if one was successfully created
point
A point on the chart (x,y)
Fields:
x (series int): Bar index (x coordinate)
y (series float)
label (series label)
leg
A pattern leg (point A to point B)
Fields:
a (point): Point A
b (point)
deltaX (series int)
deltaY (series float)
prev (leg)
next (leg)
retrace (series float)
line (series line)
pattern
A pattern (set of at least 2 connected legs)
Fields:
legs (array<leg>)
type (series string)
subType (series string)
name (series string)
pid (series string)
Pine kitaplığı
Gerçek TradingView ruhuyla, yazar bu Pine kodunu açık kaynaklı bir kütüphane olarak yayınladı, böylece topluluğumuzdaki diğer Pine programcıları onu yeniden kullanabilir. Yazara saygı! Bu kütüphaneyi özel olarak veya diğer açık kaynaklı yayınlarda kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Site Kuralları tarafından yönetilmektedir.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Pine kitaplığı
Gerçek TradingView ruhuyla, yazar bu Pine kodunu açık kaynaklı bir kütüphane olarak yayınladı, böylece topluluğumuzdaki diğer Pine programcıları onu yeniden kullanabilir. Yazara saygı! Bu kütüphaneyi özel olarak veya diğer açık kaynaklı yayınlarda kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Site Kuralları tarafından yönetilmektedir.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.