PINE LIBRARY
تم تحديثه ZigZagCore

ZigZagCore
ZigZagCore is a generic ZigZag engine that works with any user-defined threshold (ATR-based, volatility-based, fixed ticks, etc.).
API
Pine Script®
zz_update(state, thr)
Parameters:
state (ZzState)
thr (float)
ZzState
Fields:
dir (series int)
highSinceLow (series float)
lowSinceHigh (series float)
lastHighLevel (series float)
lastLowLevel (series float)
lastHighIndex (series int)
lastLowIndex (series int)
highSinceLowIndex (series int)
lowSinceHighIndex (series int)
isNewHigh (series bool)
isNewLow (series bool)
Directional State
dir = 1 → market is in an upswing
dir = -1 → market is in a downswing
dir = na → initial undecided state
Live Swing Tracking (Unconfirmed Leg)
Continuously updated swing extremes:
highSinceLow — highest price since the last confirmed low
lowSinceHigh — lowest price since the last confirmed high
Their corresponding bar indices
These fields describe the current active swing leg, which updates every bar until a pivot is confirmed.
Pivot Detection
A pivot confirms only when price moves beyond the prior swing extreme by more than threshold. When this occurs, the library sets:
isNewHigh = true (on the detection bar only) and updates lastHighLevel, lastHighIndex
isNewLow = true and updates lastLowLevel, lastLowIndex
ZigZagCore is a generic ZigZag engine that works with any user-defined threshold (ATR-based, volatility-based, fixed ticks, etc.).
API
import ReflexSignals/ZigZagCore/<version> as zz
var zz.ZzState state = zz.zz_new()
float thr = ... // your threshold in price units
state := zz.zz_update(state, thr)
zz_update(state, thr)
Parameters:
state (ZzState)
thr (float)
ZzState
Fields:
dir (series int)
highSinceLow (series float)
lowSinceHigh (series float)
lastHighLevel (series float)
lastLowLevel (series float)
lastHighIndex (series int)
lastLowIndex (series int)
highSinceLowIndex (series int)
lowSinceHighIndex (series int)
isNewHigh (series bool)
isNewLow (series bool)
Directional State
dir = 1 → market is in an upswing
dir = -1 → market is in a downswing
dir = na → initial undecided state
Live Swing Tracking (Unconfirmed Leg)
Continuously updated swing extremes:
highSinceLow — highest price since the last confirmed low
lowSinceHigh — lowest price since the last confirmed high
Their corresponding bar indices
These fields describe the current active swing leg, which updates every bar until a pivot is confirmed.
Pivot Detection
A pivot confirms only when price moves beyond the prior swing extreme by more than threshold. When this occurs, the library sets:
isNewHigh = true (on the detection bar only) and updates lastHighLevel, lastHighIndex
isNewLow = true and updates lastLowLevel, lastLowIndex
ملاحظات الأخبار
v2Added highBroken and lowBroken fields in ZzState
Updated:
ZzState
Fields:
dir (series int)
highSinceLow (series float)
lowSinceHigh (series float)
lastHighLevel (series float)
lastLowLevel (series float)
lastHighIndex (series int)
lastLowIndex (series int)
highSinceLowIndex (series int)
lowSinceHighIndex (series int)
isNewHigh (series bool)
isNewLow (series bool)
highBroken (series bool)
lowBroken (series bool)
مكتبة باين
كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشورات تخضع لقواعد الموقع.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
مكتبة باين
كمثال للقيم التي تتبناها TradingView، نشر المؤلف شيفرة باين كمكتبة مفتوحة المصدر بحيث يمكن لمبرمجي باين الآخرين من مجتمعنا استخدامه بحرية. تحياتنا للمؤلف! يمكنك استخدام هذه المكتبة بشكل خاص أو في منشورات أخرى مفتوحة المصدر، ولكن إعادة استخدام هذا الرمز في المنشورات تخضع لقواعد الموقع.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.