OPEN-SOURCE SCRIPT

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] ? 1 : close<close[1] ? -1 : 0
trend= (mov != 0) and (mov != mov[1]) ? mov : nz(trend[1])
isTrending = rising(close, trendDetectionLength) or falling(close, trendDetectionLength) 
wave=(trend != nz(wave[1])) and isTrending ? trend : nz(wave[1]) 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.
WWV_LB pivotfix histogram jayy

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:
Indicator: Weis Wave Volume [LazyBear]
  
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
Trend Analysisweisweiswave

Script de código aberto

No verdadeiro espírito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam compreendê-lo e analisá-lo. Parabéns ao autor! Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Quer usar esse script no gráfico?


Jayy

Aviso legal