PINE LIBRARY
TRZigZagLib

Library "TRZigZagLib"
method directionName(this)
Gets pivot direction as string
Namespace types: Pivot
Parameters:
this (Pivot): Pivot instance
Returns: "HIGH" or "LOW"
method isHigh(this)
Checks if pivot is a high
Namespace types: Pivot
Parameters:
this (Pivot): Pivot instance
Returns: true if pivot is a high
method isLow(this)
Checks if pivot is a low
Namespace types: Pivot
Parameters:
this (Pivot): Pivot instance
Returns: true if pivot is a low
method newSettings(minLength, minBarSize, maxBarSize)
Creates default ZigZag settings
Namespace types: series int, simple int, input int, const int
Parameters:
minLength (int): Minimum pivot length (default: 10)
minBarSize (int): Minimum bars between pivots (default: 5)
maxBarSize (int): Maximum bars to lookback (default: 300)
Returns: New ZigZagSettings instance
method setLineStyle(this, lineColor, lineWidth, lineStyle)
Sets line appearance
Namespace types: ZigZagSettings
Parameters:
this (ZigZagSettings): Settings instance
lineColor (color)
lineWidth (int)
lineStyle (string)
Returns: Modified settings instance
method newZigZag(settings, depth)
Creates a new ZigZag instance
Namespace types: ZigZagSettings
Parameters:
settings (ZigZagSettings): ZigZag settings
depth (int): Depth value for this ZigZag
Returns: New ZigZag instance
method calculate(this)
Calculates ZigZag using LuxAlgo-style pivot detection
Namespace types: ZigZag
Parameters:
this (ZigZag): ZigZag instance
method getLastPivots(this, count)
Gets the last N pivots
Namespace types: ZigZag
Parameters:
this (ZigZag): ZigZag instance
count (int): Number of pivots to get (default: 5)
Returns: Array of pivots
method getPivot(this, index)
Gets pivot at index
Namespace types: ZigZag
Parameters:
this (ZigZag): ZigZag instance
index (int): Index (0 = most recent)
Returns: Pivot or na
method truncate(this, maxBars)
Truncates old pivots beyond lookback window
Namespace types: ZigZag
Parameters:
this (ZigZag): ZigZag instance
maxBars (int): Maximum bars to keep
method newMultiZigZag(settings, minDepth, maxDepth, count)
Creates a new MultiZigZag manager
Namespace types: ZigZagSettings
Parameters:
settings (ZigZagSettings): Base settings for all ZigZags
minDepth (int): Minimum depth value
maxDepth (int): Maximum depth value
count (int): Number of ZigZag instances (max 11)
Returns: New MultiZigZag instance
method calculateAll(this)
Updates all ZigZag instances
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
method getZigZag(this, index)
Gets ZigZag at index
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
index (int): Index (0 to count-1)
Returns: ZigZag instance or na
method getDepth(this, index)
Gets depth value at index
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
index (int): Index (0 to count-1)
Returns: Depth value
method size(this)
Gets total number of ZigZag instances
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
Returns: Count of ZigZag instances
method truncateAll(this, maxBars)
Truncates all ZigZag instances
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
maxBars (int): Maximum bars to keep
method distance(p1, p2)
Calculates distance between two pivots
Namespace types: Pivot
Parameters:
p1 (Pivot): First pivot
p2 (Pivot): Second pivot
Returns: Price distance (absolute)
method barSpan(p1, p2)
Calculates bar span between two pivots
Namespace types: Pivot
Parameters:
p1 (Pivot): First pivot
p2 (Pivot): Second pivot
Returns: Bar span (absolute)
method isAlternating(pivots)
Checks if pivots are alternating (high-low-high or low-high-low)
Namespace types: array<Pivot>
Parameters:
pivots (array<Pivot>): Array of pivots
Returns: true if alternating pattern exists
Pivot
Pivot point in the chart
Fields:
d (series int): Direction: 1=high, -1=low
x (series int): Bar index
y (series float): Price
confirmed (series bool): Pivot confirmation flag
ZigZagSettings
ZigZag configuration settings
Fields:
minLength (series int): Minimum pivot detection length
minBarSize (series int): Minimum bars between pivots
maxBarSize (series int): Maximum bars to lookback
lineColor (series color): ZigZag line color
lineWidth (series int): ZigZag line width
lineStyle (series string): ZigZag line style
ZigZag
Single ZigZag instance
Fields:
settings (ZigZagSettings): Configuration settings
pivots (array<Pivot>): Array of pivot points (max 25 for patterns)
lastUpdateBar (series int): Last bar index when updated
depth (series int): Current depth value
MultiZigZag
Multi-depth ZigZag manager
Fields:
zigzags (array<ZigZag>): Array of ZigZag instances (max 11)
depthValues (array<int>): Array of depth values being used
currentBar (series int): Current bar index being processed
method directionName(this)
Gets pivot direction as string
Namespace types: Pivot
Parameters:
this (Pivot): Pivot instance
Returns: "HIGH" or "LOW"
method isHigh(this)
Checks if pivot is a high
Namespace types: Pivot
Parameters:
this (Pivot): Pivot instance
Returns: true if pivot is a high
method isLow(this)
Checks if pivot is a low
Namespace types: Pivot
Parameters:
this (Pivot): Pivot instance
Returns: true if pivot is a low
method newSettings(minLength, minBarSize, maxBarSize)
Creates default ZigZag settings
Namespace types: series int, simple int, input int, const int
Parameters:
minLength (int): Minimum pivot length (default: 10)
minBarSize (int): Minimum bars between pivots (default: 5)
maxBarSize (int): Maximum bars to lookback (default: 300)
Returns: New ZigZagSettings instance
method setLineStyle(this, lineColor, lineWidth, lineStyle)
Sets line appearance
Namespace types: ZigZagSettings
Parameters:
this (ZigZagSettings): Settings instance
lineColor (color)
lineWidth (int)
lineStyle (string)
Returns: Modified settings instance
method newZigZag(settings, depth)
Creates a new ZigZag instance
Namespace types: ZigZagSettings
Parameters:
settings (ZigZagSettings): ZigZag settings
depth (int): Depth value for this ZigZag
Returns: New ZigZag instance
method calculate(this)
Calculates ZigZag using LuxAlgo-style pivot detection
Namespace types: ZigZag
Parameters:
this (ZigZag): ZigZag instance
method getLastPivots(this, count)
Gets the last N pivots
Namespace types: ZigZag
Parameters:
this (ZigZag): ZigZag instance
count (int): Number of pivots to get (default: 5)
Returns: Array of pivots
method getPivot(this, index)
Gets pivot at index
Namespace types: ZigZag
Parameters:
this (ZigZag): ZigZag instance
index (int): Index (0 = most recent)
Returns: Pivot or na
method truncate(this, maxBars)
Truncates old pivots beyond lookback window
Namespace types: ZigZag
Parameters:
this (ZigZag): ZigZag instance
maxBars (int): Maximum bars to keep
method newMultiZigZag(settings, minDepth, maxDepth, count)
Creates a new MultiZigZag manager
Namespace types: ZigZagSettings
Parameters:
settings (ZigZagSettings): Base settings for all ZigZags
minDepth (int): Minimum depth value
maxDepth (int): Maximum depth value
count (int): Number of ZigZag instances (max 11)
Returns: New MultiZigZag instance
method calculateAll(this)
Updates all ZigZag instances
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
method getZigZag(this, index)
Gets ZigZag at index
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
index (int): Index (0 to count-1)
Returns: ZigZag instance or na
method getDepth(this, index)
Gets depth value at index
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
index (int): Index (0 to count-1)
Returns: Depth value
method size(this)
Gets total number of ZigZag instances
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
Returns: Count of ZigZag instances
method truncateAll(this, maxBars)
Truncates all ZigZag instances
Namespace types: MultiZigZag
Parameters:
this (MultiZigZag): MultiZigZag instance
maxBars (int): Maximum bars to keep
method distance(p1, p2)
Calculates distance between two pivots
Namespace types: Pivot
Parameters:
p1 (Pivot): First pivot
p2 (Pivot): Second pivot
Returns: Price distance (absolute)
method barSpan(p1, p2)
Calculates bar span between two pivots
Namespace types: Pivot
Parameters:
p1 (Pivot): First pivot
p2 (Pivot): Second pivot
Returns: Bar span (absolute)
method isAlternating(pivots)
Checks if pivots are alternating (high-low-high or low-high-low)
Namespace types: array<Pivot>
Parameters:
pivots (array<Pivot>): Array of pivots
Returns: true if alternating pattern exists
Pivot
Pivot point in the chart
Fields:
d (series int): Direction: 1=high, -1=low
x (series int): Bar index
y (series float): Price
confirmed (series bool): Pivot confirmation flag
ZigZagSettings
ZigZag configuration settings
Fields:
minLength (series int): Minimum pivot detection length
minBarSize (series int): Minimum bars between pivots
maxBarSize (series int): Maximum bars to lookback
lineColor (series color): ZigZag line color
lineWidth (series int): ZigZag line width
lineStyle (series string): ZigZag line style
ZigZag
Single ZigZag instance
Fields:
settings (ZigZagSettings): Configuration settings
pivots (array<Pivot>): Array of pivot points (max 25 for patterns)
lastUpdateBar (series int): Last bar index when updated
depth (series int): Current depth value
MultiZigZag
Multi-depth ZigZag manager
Fields:
zigzags (array<ZigZag>): Array of ZigZag instances (max 11)
depthValues (array<int>): Array of depth values being used
currentBar (series int): Current bar index being processed
ไลบรารีไพน์
ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนได้เผยแพร่ Pine code นี้เป็นโอเพนซอร์สไลบรารีเพื่อให้ Pine โปรแกรมเมอร์คนอื่นในชุมชนของเราสามารถนำไปใช้ซ้ำได้ ต้องขอบคุณผู้เขียน! คุณสามารถใช้ไลบรารีนี้ในแบบส่วนตัวหรือในการเผยแพร่แบบโอเพนซอร์สอื่น ๆ แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
ไลบรารีไพน์
ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนได้เผยแพร่ Pine code นี้เป็นโอเพนซอร์สไลบรารีเพื่อให้ Pine โปรแกรมเมอร์คนอื่นในชุมชนของเราสามารถนำไปใช้ซ้ำได้ ต้องขอบคุณผู้เขียน! คุณสามารถใช้ไลบรารีนี้ในแบบส่วนตัวหรือในการเผยแพร่แบบโอเพนซอร์สอื่น ๆ แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน