Cumulative Volume ZigZag (live version)

Cumulative Volume ZigZag (live version)

This Cumulative Volume indicator helps in understanding the change in volume related to peaks and troughs (referred to as ‘tough’ in the code) of price movement based on the ZigZag indicator.

Here is a detailed explanation of the code:

  1. defparam drawonlastbaronly=true: This line sets the parameter to draw the indicator only on the last bar of the chart to save computation resources.
  2. The parameters are set: percentVariation is set to 0.04, which defines the minimum price change necessary for the ZigZag indicator to alter its direction. BarsLimit is set to 200, which is the maximum number of bars for which the histogram is drawn.
  3. zz = ZigZag[percentVariation](close): This line calculates the ZigZag indicator based on the closing prices and the percent variation defined.
  4. peak = zz<zz[1] and zz[1]>zz[2] and tough = zz>zz[1] and zz[1]<zz[2] are lines that define conditions for identifying peaks and troughs. A peak is identified when the current ZigZag value is less than the previous value and the previous value was greater than the one before it. Similarly, a trough is identified when the current ZigZag value is greater than the previous one and the previous value was less than the one before it.
  5. cumV = cumV+volume: This line is used to calculate the cumulative volume up to the current bar.
  6. The array $barvol is used to store the cumulative volume for each bar. The $barcolor array is used to store the color for the current trend.
  7. If a peak or trough is identified, the cumulative volume (cumV) is reset to the current bar’s volume, and the trend color (color) is set accordingly. If a peak is identified, color is set to -1, indicating a downward trend. If a trough is identified, color is set to 1, indicating an upward trend.
  8. The if islastbarupdate then block is executed on every last bar update. It draws rectangles on the last BarsLimit number of bars based on the stored volumes and colors.
  9. return cumV coloured(0,0,0,0) : This line is to return the current cumulative volume as the value of the indicator. The color of this line is set to transparent (all zeros), meaning that the line won’t be visible on the chart. The visual representation of this indicator is done by the rectangles drawn in the previous step.

This code will effectively create a volume histogram where the color of each bar represents the direction of the trend, and the height of the bar represents the cumulative volume of the trend. Peaks and troughs will reset the cumulative volume, starting a new bar in the histogram.

 

Share this

Risk disclosure:

No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.

ProRealTime ITF files and other attachments : How to import ITF files into ProRealTime platform?

PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials

  1. Sofitech • 06/26/2023 #

    Il y a une erreur dans le code après installation. “Un caractère de type entier est attendu avec barcolor”

    • Nicolas • 06/26/2023 #

      Il doit y avoir impérativement plus d’unités affichées que le paramètre “BarsLimit”. Ceci étant j’ai contasté une erreur dans cette version sur la mise à jour de la dernière jambe du zigzag, je corrigerai bientôt.

  2. steffen_burat • 06/26/2023 #

    Hello Nicolas,

    I have a cumulative histogram update problem, the indicator often updates or cumulate only after restarting the indicator, what should I try to do?

  3. taklause • 06/26/2023 #

    Hello Nicolas, if I try to use your indicator in a trading system, the error on prc pops up that that the indicator (ZigZag) contains code that the current “backtest monitor” does not support. Is there a way to fix this? Thanks for replying.

  4. Gio56 • 182 days ago #

    Bonjour Nicolas J’ai le meme souci que steffen , l’indicateur ne cumule qu’après avoir redémarré l’indicateur ou modifier les donné percent variation, une idée? Merci.

avatar
Register or

Likes

avatar avatar avatar avatar avatar
Related users ' posts
Vinks_o_7 b=close > low and volume > high How can we compare volume and high of the day? (orang...
TAC Bolsa If to understand something you resort to compare Oranges and bananas. You go bad, Without e...
giumagi good morning Sir, great job your indicators! How can I reach your website or blog? please..t...
Gianluca THANK YOU!!!!!
JOSEBA que relaccion tiene la numeración de las barras del 1 al 10 que tiene cada número Tengo dos...
marcov66 Hi, it seems a very useful indicator. Unfortunately the link here for the full explanation d...
TACBOLSA Discontinued indicator. we are sorry.
Azzuerus Bonjour, je teste et j'utilise vos indicateurs depuis plusieurs années, et ils me sont dev...
bremze33 Another thing. Is it possible to make the graph lines a little thicker and not so long? Be...
giumagi Hi Sir, very good job done with this indicator, May I ask you to explain what is the line VW...
pmdr1969 Hola soy nuevo en en esto. ¿Hay algo parecido pero pudiendo tu elegir las velas a a analizar...
datageek How do I change the thickness of the line or change it too dashed lines? Kind regards
lkiklkik NE fonctionne pas ( ou plus ... )
Nicolas il faut modifier toutes les références à top par itop et bottom par ibottom. Ces mots étant ...
Nicolas Add indicator on price doesnt require any specific type of subcription. Click on the wrench ...
tahiti bonjour j'ai une petite question comment peux on enlevé la bar blanche sur la bougie en cour...
sixeight Hi Kris, is there a way to increase the number of rows? I get a loop error
Nicolas Good job Gabri, I confirm that with the new ProRealTime v11, everyone will be able to use in...
Slowlyslowly can u just help me with the exact definition of percbox , mm and period to understand will a...
Real Pro Great work gabri. I have this coded on Amibroker and I have done lots of backtesting but ne...
gabri Hi Real Pro, this indicator assists novices of the Wyckoff system. Wyckoff himself thought t...
tatie hi Gabri, I just came across the wyckoff method and was looking for the weiss wave indica...
Jesper Great share!
teddy58 Ich habe es mit N= 1,5 und N=2,5 getestet mit 200000 Einheiten. Es funktioniert leider erst ...
Matriciel I use this indicator to help me make a decision when there is a divergence. The divergences ...
Jan Wind Hi, I personnaly am not a big fan of ZIGZAG indicator, as it repaints itself during time. ...
Nicolas Sure, I suggest you open a new topic in the forum to discuss about your ideas.
hdgm Bonjour Nicolas, est ce que l'on peut en faire une stratégie de trading automatisée ?
Nicolas Non, pas en utilisant l'indicateur zigzag traditionnel de la plateforme.
eckaw Hi Nicolas, I'm using this indicator when there is confluence over 3 different timeframes (5...
Nicolas Yes it is indeed possible. Create a topic in the screener forum and explain what you need an...
KyleReed i've been using this for a few days now and it's really helped me a lot in timing the execut...
Ben Ji Bonjour Nicolas, je souhaiterais exploiter votre screener sur la plateforme TradingView. Pou...
Nicolas Non désolé, je ne fournis pas de support pour cette plateforme.
luxrun Thanks, bolsatrilera, for a very good and solid screener!
luxrun sorry... indicator!
Lily Rios Gracias por el indicador, tengo una pregunta necesito programar un screener de valores que e...
mmoren44 no esta el color azul (Fade //Blue), No aparece en las barras el color azul.
larouedegann changer fade coloured (0,0,255)
Nicolas 1. yes 2. maybe yes?! 3. why not?
patapouf Bonjour Nicolas. Je viens de découvrir cet indicateur, que je trouve bien intéressant Mais...
Nicolas Tu peux modifier le paramètre "scalefactor" pour adapter la hauteur des barres à ton graphiq...

Top