This is standard zigzag indicator. I just coded them using lines array feature of pine - so that it can be done in least number of lines of code.
Few possible improvements:
Use label array to mark HH, HL, LH and LL
Add standard deviation check
ملاحظات الأخبار
Added updates mentioned in the description.
ملاحظات الأخبار
Corrected HL and LH labels
ملاحظات الأخبار
Added ratios display.
ملاحظات الأخبار
Previously, using pivotHigh and pivotLow on every bar for last 10 periods caused some inconsistencies in plotting zigzag. Hence, switched to points based calculation. However, zigzags are still created via lines array
Fixed empty label issue
ملاحظات الأخبار
Solved array index out of bounds issue
ملاحظات الأخبار
Adding option to apply zigzag on different source such as RSI. This enables plotting zigzag and ratios on RSI - which can be used for finding divergence.
ملاحظات الأخبار
Corrected minor logical error.
Removed DeviationThreshold as it was leading to wrong calculation
In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publications is governed by House rules. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.
هل تريد استخدام هذا النص البرمجي على الرسم البياني؟
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.