jayy

WWV_LB zigzag pivot fix jayy

This is a zigzag version of LazyBear's WWV_LB. In order to plot the WWV_LB as a zigzag, it made sense to me to set the zigzag pivot at the true WWV_LB low or high pivot bars as opposed to the "pivot" bars plotted by the original WWV_LB script. The pivot point identified in the WWV_LB script is actually the point at which a wave reversal is confirmed as opposed to the true script pivot point.  Confirmation of a wave reversal can, at times, lag the true pivot by a few bars especially as trendDetectionLength values increase above "1". The WWV_LB script calculates cumulative volume from wave reversal confirmation bar to wave reversal confirmation bar as opposed to the actual/true WWV_LB  reversal pivot bar to reversal pivot bar.  As such the waves plotted by the original and this pivot fixed scripts not only look slightly different but can also have different cumulative volumes. Confirmation of a wave reversal can lag a few bars behind the true pivot point. 
The following critical lines of the original WWV_LB script determine when a wave reverses, both the true pivot and the confirmation point:mov = close>close ? 1 : close<close ? -1 : 0
trend= (mov != 0) and (mov != mov) ? mov : nz(trend)
isTrending = rising(close, trendDetectionLength) or falling(close, trendDetectionLength) 
wave=(trend != nz(wave)) and isTrending ? trend : nz(wave) These original script lines are replicated in lines 62 to 65 of my script and are used to define wave reversal pivot bars and wave reversal confirmation bars. The original WWV_LB script does not track potential or actual pivot bars.  The information can be extracted and tracked from the original script and then used to plot the actual reversal pivot bars.  This allows the volume to be tracked from the actual/true pivot bars.Instead of "trendDetectionLength"  I have inserted "Trend Detection Length" in the dialogue boxes.   You can of course change the descriptor to what you wish by editing script line 33 to the original term or whatever you wish.  You might also wish to set the default to the value "2" as per the original script.  I have set the default to "3". 
If you use a dark background I suggest you edit script line 4 from blackr=black to something such as blackr=yellow The volume values are shown in a vertical column of 3 numbers. Given the limitations of Pinescript Version 3 relative to V4, they are plotted at the point where the wave reversal is confirmed as opposed to the true pivot point.  The zigzag lines plot the true pivot points.  The plot location of numbers could be improved in Pinescript Version 4.  I explain below why I have not published the Pinescript version 4 scripThe volume values plotted on the chart are calculated to be relative numbers.  The script is limited to showing only three numbers vertically.  Only the highest three values of a number are shown.  For example, if the highest recent pip value is 12,345 only the first 3 numerals would be displayed ie 123.  But suppose there is a recent value of 691.  It would not be helpful to display 691 if the other wave size is shown as 123. To give the appropriate relative value the script will show a value of 7 instead of 691. This informs you of the relative magnitude of the values.  This is done automatically within the script.  There is likely no need to manually override the automatically calculated value.  I will create a video that demonstrates the manual override method.  
Should you update to Pinescript version 4?  You could but if you do you will need to change the "plotchar" criteria since this script will exceed the 64 plot limit when converted to version 4.  Version 4 would also allow the zigzags lines to be straight lines.   However, the 50 label and line plot limit (Pinescript calls this resource sparing feature "garbage collection") significantly truncates the screen available information provided on screen.   This algo optionally allows the plotting of zigzags as calculated by the original WWV_LB script. Toggling between the two script versions allows you to see the zigzag plot differences. I have also made some modifications to the original WWV_LB histogram script to adjust the pivot points.This zigzag script should be used in conjunction with the "WWV_LB pivot fix histogram jayy" shown in the panel below the main screen. Here is a link to the original LazyBear histogram script which can be used for comparison.  The differences are subtle, however, the histograms will regularly be different by a bar or two:
  
The lowest panel has the original LazyBear WWV_LB script for comparison.  All three scripts have been set to a Trend Detection Length of 3.
jayy

Jayy
نص برمجي مفتوح المصدر

قام مؤلف هذا النص البرمجي بنشره وجعله مفتوح المصدر، بحيث يمكن للمتداولين فهمه والتحقق منه، وهو الأمر الذي يدخل ضمن قيم TradingView. تحياتنا للمؤلف! يمكنك استخدامه مجانًا، ولكن إعادة استخدام هذا الكود في منشور تحكمه قواعد الموقع. يمكنك جعله مفضلاً لاستخدامه على الرسم البياني.

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.

هل تريد استخدام هذا النص البرمجي على الرسم البياني؟