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 • 180 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
ChemaGeek Bonjour Nicolas, j'ai récemment découvert cet indicateur (Regularized Momentum 2017) et je l...
YvesRobert Bonjour, nouveau sur PRT (qq jours), j'essaie un peu de voir quel type d'indicateur me convi...
Ichimoku Reading I don't know in this case, I just downloaded it again and no problem for me. Try to downloa...
Ichimoku Reading What's the error that appears ?
Suzu Yuk Yes, it worked with 1Tick with 200 K . Thank you very much.
Monobrow Hi Daniele Thank you for the indicator, it looks very good. However, I have a problem so...
avatar
Anonymous Thanks very much for sharing, look forward to testing this idea out.
mathiasKN Thank you Daniele for making this script, I know its been some time since the release but wo...
StephFor //ind1 = ZigZagPoint[2*averagetruerange[200]](close) avr = 3 //3% ind1 = ZigZag[avr](close...
Manu L. @Steph un grand merci pour ton aide mais :-( J'ai copier le code tel quel mais cependant j...
AlphaMauss Je n'ai pas réussi à faire fonctionner l'indicateur avec le code fourni en commentaire sur P...
Barrabas15 Apparently, according to the attached data, there is an error in the indicator code. Attach...
Barrabas15 The files are at the end of the following link: https://www.prorealcode.com/topic/time-seg...
robertogozzi Thank you Barrabas15, the correct code is at https://www.prorealcode.com/topic/time-segmente...
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!
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...
mobychix Hi, I just joined Pro Realtime and am very interested in VSA. I have read some books and did...
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...
Vinks_o_7 Apirine also offers a very interesting update of the OBV...
TACBOLSA
6 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?

Top