TradingView
rumpypumpydumpy
15 nov 2020 23:12

Equivolume Bars 

ChainLink / TetherUSBinance

Descrizione

Equivolume bars. Width is determined by volume. Please note that equivolume bars are rendered independently of the time scale.

Makes use of @LonesomeTheBlue's "Start the Script on Last Nth Bar" in order to prevent time out. As such you are only able to view the most recent bars and no bar replay beyond that range.

Note di rilascio

Added a secondary style which makes OHLC visible. With the new style the left vertical line is always the low, right vertical line the high. Horizontal lines are shift to open/close.

Note di rilascio

Referencing length error fix

Note di rilascio

Major update
Complete rewrite to take advantage of new box() functions.

Instructions


This has been coded in a specific way due to certain chart properties being inaccessible via Pine. It requires a few simple manual steps to be set up correctly.

First add the equivolume indicator(s) to your chart

Next from the chart toolbar, change the chart type to line chart.

Then from the chart settings (right click chart / Settings). Under the Symbol section, change the Line color opacity to 0 (fully transparent).

From the chart settings in the Appearance section, set the top and bottom margins to 0 (Margins will be controlled from within the script).

Next set the chart's ticker scale to no scale (the three dot symbol to the right of the ticker id on the chart itself), select Pin to scale / No scale (fullscreen)

Then lastly, set the indicator(s) scales the same way, but make sure they are pinned to the same left or right scale (usually A). It doesn't matter which as long it's the same one.
The exception is the volume bar overlay which should be set to no scale as well.

If you change any of the margin settings / equivolume settings you need to ensure they are copied over to the other overlays to ensure that everything is positioned the same.

At this point, zoom out to ensure the full bar set is loaded. Everything should line up at this point and you can zoom back in if you want to.

The available addons for equivolume can be found here
Commenti
PineCoders
Pratik_4Clover
Nice work! Thanks!
marketrading001
I think if you use the start_index to determine the highs/lows/opens/closes (i.e high[start_index]) of the equivolume, it'll give equivolume bars that correspond to the price.
Wanted to ask you why you use total_volume[1] in your calculation of bar_width? Why don't you just use total_volume?
rumpypumpydumpy
@marketrading001, Do you mean why not the cumulative volume total instead of the sum of the default 60 last bar's volume? As far as I know this is how equivolume is supposed to be constructed.
marketrading001
@rumpypumpydumpy, No no, I mean why did you use previous bar's total_volume in calculating the bar_width. TV doesn't allow me to use "bracket 1 bracket" in the text
rumpypumpydumpy
@marketrading001, you are comparing the current bar's volume to the previous sixty. Otherwise the total would include the current bar's volume.
marketrading001
@rumpypumpydumpy, But excluding the current bar's volume would omit alot of valuable information, no? In other words, the current volume box would not include the current volume. I mean, in the code, it still doesn't necessarily do so, because from what I saw, you're using bars that are not occurring at the same time as the volume box, right? Using bar_width[start_index] could solve that problem, instead of doing an array and using the bar_width for each candle bar. But back to the current volume, I actually don't know how equivolume bars are normally calculated, so I'm not sure what is best: to use the current volume bar or not.
rumpypumpydumpy
@marketrading001, There's no problem dude. Line 103. It is referencing bar_width FOR THAT BAR, ie that bar's volume / the sum of the previous 60 bars' volume (PRECEEDING that referenced bar). It doesn't exclude the current bar's volume. The width is determined by the ratio (bar_width). ie current bar's volume / total of previous 60 bar's volume. From how i've seen it described elsewhere this is how equivolume is implemented.
anshdeo
Hi, is it possible to modify the code someway to make the wicks thinner? I don't know pine, I've tried to mess around with the code but can't seem to figure it out, any help?
Bearishness
look good
Altro