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 • 188 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
Nicolas Better to download the file from the page and import it into your platform in order to not c...
marcov66 Hi Nicolas, thanks for sharing the VWAP Date Indicator. It is really powerful. Nevertheless,...
Nicolas Are you sure you are using the same exact date, hours, minutes, seconds for anchor?
julien1978 changing the trendDetectionLength setting does not seem to have any effect on the wave calcu...
arran i can't seem to get this indicator to work on forex pairs. it works great on indices etc. An...
Nicolas Indicator needs Volume, and there are no volumes with forex pairs with IG.
Trading_En_El_Ibex35 El screener no busca acciones que estén en máximos absolutos , busca acciones en las que el...
Andraxx lo de volumen aceptable, lo dices en relación al Ibex 35 supongo. Porque se margen de volume...
Juanjo Hola Queria preguntarte si la idea de maximos anuales es tuya, o bien está basada en el sis...
BERTJES82 Hi Nicolas, is it possible to adjust the starting date of the VWAP on the charts? Thanks in ...
Nicolas Yes, have a look there: https://www.prorealcode.com/prorealtime-indicators/vwap-date-anchored/
Dadoo Merci Nicolas!
Thomas007 Is there any way to build something similar for FX? I wonder what would be the replacement f...
Jean-Pierre Poulain When I buy and when I sell ?
Nicolas The featured image of the post do not deserve the indicator you are right, I attached other ...
Nicolas It is described in the post already :) The BUY/SELL signals are quite similar of what you ca...
Nicolas
8 years ago
jiminykricket Hi Nicolas, Its fair to say i'm a relative novice with ProRealtime and as such i am not sur...
Nicolas You can use assisted creation in probacktest, you'll get a quick overview on how to call a p...
jiminykricket Thanks Nicolas, i'll take a look
bolsatrilera
8 years ago
Volume Stops
v10.3
Volume Stops
6
Indicators
Aragorna Hello, ask for a help, please. why the indicator in my PRT is in a different area and not in...
Nicolas Add it on the price chart: https://www.prorealcode.com/blog/video-tutorials/how-to-add-an-in...
Infanta Congratulations. Of all the indicators that I have been able to examine, in my opinion and f...
Nicolas
8 years ago
Voluminator
Voluminator
0
Indicators
Nicolas
8 years ago
Nicolas Sure, please open a new topic in the probuilder forum with all specifications needed.
toni1750 Hola, funciona en P11? lo he puesto y no me sale como en la imagen. gracias.
GustavoLoboOrenstein Hello Nicolas, I have a cumulative histogram update problem, the indicator often updates ...
Nicolas That's right, in ProScreener we can't have a lookback more than 254 days. There is nothing w...
cjdevasia Hi, Nicolas,     please guide me how can i scan following conditions in pro real time  S...
Nicolas For everyone benefit, I prefer to answer coding request in the forum. Please open a new topi...
Nicolas Thanks for contributing to the "ichimoku section" of the prorealtime code library Don't he...
sourberry Thank you , this is a great indicator works beautifully. Could you kindly modify to scr...
pp_playaflamenca Excuse me,... reading your code about spanB: [ SenkouSpanBFutureW = (Highest[SenkouSpanPerio...
Nicolas
8 years ago
Better Volume
Better Volume
39
Indicators
Keyeming Hello Nicolas; not sure to undersntad line 167, and in the video I d'ont remember that the a...
Nicolas I don't know, this code is 6 years old and I made a 1:1 translation of the provided code by ...
Alai-n https://emini-watch.com/free-stuff/volume-indicator/
Nicolas
9 years ago
Nicolas You will find the VWAP code from PRT here: https://www.prorealcode.com/topic/is-there-any-wo...
keks Thanks for sharing this wonderful code. Is there a way to draw a horizontal line to plot pre...
taklause Hello, just one question, can it be that this indicator does not work on ProRealTime v12? T...
Nicolas
9 years ago
Nicolas add it on price chart, change the cp parameter according to the period you want to observe f...
Robert22 hola buenos días: yo estoy buscando una cosa parecida para realizar con ello un indicador de...
Nicolas https://www.prorealcode.com/prorealtime-indicators/rsi-classical-hidden-divergences-indicator/
pata_tony Hi, i'm not able to see the indicator. Could you please help me? Thanks
Nicolas This is not an indicator but a screener, to be used with the ProScreener module.
JOKAMAURICE Le programme ne se charge pas dans PRT
RobHansson Thanks for this screener. I would like the tool removed the shares that have been on the lis...
davidspain hello doctor!! amazing job. I would like to ask u if it is possible to create an indicator ...
GABRIELE1976 bonjour, je voudrais utiliser ce screener pour trouver les titres qui, à l’ouverture de la j...
Nicolas
9 years ago
Up on Big Volume
Up on Big Volume
0
Screeners

Top