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 • 321 days ago #

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

    • Nicolas • 321 days ago #

      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 • 273 days ago #

    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 • 143 days ago #

    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.

avatar
Register or

Likes

avatar avatar avatar avatar avatar
Related users ' posts
Nicolas esta possible
bolsatonimora2 Hola Nicolas, perdona la molestia, pero podrias codificar el screener para rupturas de sopor...
Nicolas Utilice los foros para solicitar una codificación personalizada.
GARNIEPI hello I am looking for an anchored vwap intraday, indicator which allows you to visualize th...
withoutwings To be able to flexibly wrap around the full 24h (i.e. past midnight), or to use just a singl...
yeoreum Thank you very much for the screener, it reminds me on Minervini VCP. How to change th...
reecet any codes like this but in minutes and hours rather than days?
PHAN100 bonjour, je viens de tester ce screener, je constate une anomalie...il ne renvoie pas l'e...
jaginho Bonjour Vivien, je n'arrive pas à comprendre ce screener... En tout cas merci pour tes contr...
avatar
Anonymous Superb, merci!
kal Buenos días TACBOLSA. Estoy muy interesado en ver tu blog para ver la explicación con detall...
1Randy I would be interested an invite to your blog. I am still learning about the VSA and it looks...
repropel Buenos días TACBOLSA. Yo también estoy interesado en visitar tu blog. Podrías enviarme una i...
Maxime Baudin Very useful! Thanks Mat, and Happy New Year
nicko Great work. Thank you. However I am having trouble getting it to print in the first bar. If ...
Marie-Eve Vergoz Bonsoir - Voici l'erreur qui est signalée lorsque je souhaite utiliser cet indicateur : il...
Meta Signals Pro Pleasure ! Please let us know if you make good trades with it and if you see improvements we...
francis59 Bonjour, Bonjour, comment puis-je créer un screener basé sur cet indicateur, qui affiche le...
Trader Sab I am curious to try it how, however I get an error message for line 47 and 48 - drawsegment,...
Om Hello, thanks for sharing! Getting a message that Variable P is undefined?
matin Intraday Average Volume Indicator Not working, what can i do plz
LucioleLucide Clean view, thanks for sharing
dertopen hi where i can found the window for candle configuration?
paolosab69 Ciao! . I have seen the pictures that explain this metod but i don't understand when is mome...
Ciccio
5 years ago
Vinks_o_7 Apirine also offers a very interesting update of the OBV...
TACBOLSA
5 years ago
dario ti please can you help me to understand? i know i am wrong: Long Histogram = High Volume S...
TAC Bolsa hi, I have already seen the problem and requested that it be removed until an adequate so...
sixeight Hey TAC, Did you ever find a solution to this?
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...

Top