Indicators: Better Volume Indicator & InstrumentVolume

Better Volume Indicator
This is a direct port of a famous indicator from Tradestation platform.

BVI improves on your typical volume histogram by coloring the bars based on 5 criteria:
* Volume Climax Up – high volume , high range, up bars (red)
* Volume Climax Down – high volume , high range, down bars (white)
* High Volume Churn – high volume , low range bars (green, barcolor= blue)
* Low Volume – low volume bars (yellow)
* Volume Climax plus High Volume Churn – both the above conditions (magenta)

When there are no volume signals the default histogram bar coloring is cyan.

Bars can also be colored to match volume color. Enable "Change BarColors?" in the options page.

Volume Climax Up bars are typically seen at:
* The start of up trends
* The end of up trends, and
* Pullbacks during down trends.

Volume Climax Down bars are typically seen at:
* The start of down trends
* The end of down trends, and
* Pullbacks during up trends.

High Volume Churn bars are typically seen at:
* The end of up trends
* The end of down trends, and
* Profit taking mid-trend.

Low Volume bars are typically seen at:
* The end of up trends
* The end of down trends, and
* Pullbacks mid-trend.

More info:

Instrument Volume
This is a simple script that allows you to plot volume for any instrument.

Very handy when you want to compare volumes. Just add multiple instances and select the symbol you want via Options page.

This script also gets close/open for the selected symbol. If you are itching to get started on Pinescripting (scripting language used at TV), I suggest trying out the following, using this script as the template:
- Show RSI for any instrument
(hint: "close" for the selected symbol is already in script. Do a "plot( rsi (c, 14))")
- MACD / CCI / ....
- Plot the difference (not correlation). This may be of interest in some instruments.
For ex. BTC in BTCE exchange mostly lags BITSTAMP .

Hope this piques your interest in Pine. Feel free to post in the Pinescript room if you have any queries.
Remove from Favorite Scripts Add to Favorite Scripts
// @author LazyBear
// If you use this code in its original/modified form, do drop me a note. 
study(title = "Better Volume Indicator [LazyBear]", shorttitle="BVI_LB")

// Configurable params
length=input(8, title="Lookback")
enableBarColors=input(false, type=bool)
use2Bars=input(true, type=bool)
lowVol=input(true, type=bool)
climaxUp=input(true, type=bool)
climaxDown=input(true, type=bool)
churn=input(true, type=bool)
climaxChurn=input(true, type=bool)

// Tweak the colors
lowVolColor = yellow
climaxUpColor = red
climaxDownColor = white
churnColor = green
climaxChurnColor = #8B008B
defColor = #00FFFF	 

// Don't change anything below this
v1 = close >= open ? (v * ((range) / ((2+(range*range)/10) * range + (open - close)))) : (v * (((range + close - open)) / (2+(range*range)/10) * range + (close - open)))
v2 = v - v1
v3 = v1 + v2
v4 = v1 * range
v5 = (v1 - v2) * range
v6 = v2 * range
v7 = (v2 - v1) * range
v8 = (range != 0 ?  v1 / range : 1)
v9 = (range != 0 ? (v1 - v2) / range : 1)
v10 = (range != 0 ?  v2 / range : 1)
v11 = (range != 0 ?  (v2 - v1) / range :  1)
v12 = (range != 0 ?  v3 / range : 1)
v13 = use2Bars ? v3 + v3[1] : 1
v14 = (use2Bars ? (v1 + v1[1])*(highest(high,2)-lowest(low,2)) : 1)
v15 = (use2Bars ? (v1 + v1[1]-v2-v2[1])*(highest(high,2)-lowest(low,2)) : 1)
v16 = (use2Bars ? (v2 + v2[1])*(highest(high,2)-lowest(low,2)) : 1)
v17 = (use2Bars ? (v2 + v2[1]-v1-v1[1])*(highest(high,2)-lowest(low,2)) : 1)
v18 =  ((use2Bars and (highest(high,2)!=lowest(low,2))) ? (v1+v1[1])/(highest(high,2)-lowest(low,2)) : 1)
v19 = ((use2Bars and (highest(high,2)!=lowest(low,2))) ? (v1+v1[1]-v2-v2[1])/(highest(high,2)-lowest(low,2)) : 1)
v20 = ((use2Bars and (highest(high,2)!=lowest(low,2))) ? (v2+v2[1])/(highest(high,2)-lowest(low,2)) : 1)
v21 = ((use2Bars and (highest(high,2)!=lowest(low,2))) ? (v2+v2[1]-v1-v1[1])/(highest(high,2)-lowest(low,2)) : 1)
v22 = ((use2Bars and (highest(high,2)!=lowest(low,2))) ? v13/(highest(high,2)-lowest(low,2)) : 1)

c1 = (v3 == lowest(v3, length) ?  1 : 0)
c2 = ((v4 == highest(v4, length) and close > open) ? 1 : 0)
c3 = ((v5 == highest(v5, length) and close > open) ? 1 : 0)
c4 = ((v6 == highest(v6, length) and close < open) ? 1 : 0)
c5 = ((v7 == highest(v7, length) and close < open) ? 1 : 0)
c6 = ((v8 == lowest(v8, length) and close < open) ? 1 : 0)
c7 = ((v9 == lowest(v9, length) and close < open) ? 1 : 0)
c8 = ((v10 == lowest(v10, length) and close > open) ? 1 : 0)
c9 = ((v11 == lowest(v11, length) and close > open) ? 1 :  0)
c10 = (v12 == highest(v12, length) ? 1 : 0)
c11 = (use2Bars and (v13==lowest(v13,length) and close > open and close[1] > open[1]) ? 1 : 0)
c12 = (use2Bars and (v14==highest(v14,length) and close > open and close[1] > open[1]) ? 1 : 0)
c13 = (use2Bars and (v15==highest(v15,length) and close > open and close[1] < open[1]) ? 1 : 0)
c14 = (use2Bars and (v16==lowest(v16,length) and close < open and close[1] < open[1]) ? 1 : 0)
c15 = (use2Bars and (v17==lowest(v17,length) and close < open and close[1] < open[1]) ? 1 : 0)
c16 = (use2Bars and (v18==lowest(v18,length) and close < open and close[1] < open[1]) ? 1 : 0)
c17 = (use2Bars and (v19==lowest(v19,length) and close > open and close[1] < open[1]) ? 1 : 0)
c18 = (use2Bars and (v20==lowest(v20,length) and close > open and close[1] > open[1]) ? 1 : 0)
c19 = (use2Bars and (v21==lowest(v21,length) and close > open and close[1] > open[1]) ? 1 : 0)
c20 = (use2Bars and (v22==lowest(v22,length)) ? 1 : 0)

c0=(climaxUp and (c2 or c3 or c8 or c9 or c12 or c13 or c18 or c19)) ? climaxUpColor : ((climaxDown and (c4 or c5 or c6 or c7 or c14 or c15 or c16 or c17)) ? climaxDownColor : ((churn and c10 or c20) ? churnColor : defColor))
v_color=(climaxChurn and (c10 or c20)) and (c2 or c3 or c4 or c5 or c6 or c7 or c8 or c9) ? climaxChurnColor : ((lowVol and (c1 or c11)) ? lowVolColor : c0)
plot(not enableBarColors ? volume : na, style=columns, linewidth=1, color = v_color)
plot(not enableBarColors ? sma(volume, length) : na, color=orange, linewidth=2)
barcolor(enableBarColors ? v_color : na)
How did you get the BVI colors on bars?
+3 Reply
LazyBear PRO sublimares2
Go to options page. Select "EnableBarColors". This turns off histogram, so you can merge up.
+2 Reply
sublimares2 LazyBear
worked- thank you
+2 Reply
LazyBear PRO sublimares2
yw :)
+2 Reply
Thanks for sharing
+2 Reply
+1 Reply
You're becoming a bit of a celebrity here on TradingVIew
+4 Reply
LazyBear PRO QuantitativeExhaustion
lol..wot? :P
+2 Reply
grahvity LazyBear
Do you sign body parts?
+1 Reply
vlad.adrian PRO QuantitativeExhaustion
Yes he does!!
+2 Reply
A sample for InstrumentVolume indicator. Chart below compares the volumes of BTCUSD on 4 exchanges.


+3 Reply
Talk about serendipity; I was looking for a VSA analysis indicator like this and not finding it. Thanks!
+1 Reply
LazyBear PRO MiguelMorais
YW. Try out VCPI (Volume Price Confirmation) too (check my published charts).

Also, I have another VSA indicator in the pipeline, ready to be published. So, do check back :)
+1 Reply
Excellent indicators. Do you have any instructions on implementing them in Tradingview? Thanks.
+1 Reply
LazyBear PRO AdrianCooper
You can import indicators from any published chart in to your custom scripts section and use it in your charts.

Try this walkthrough (PDF) I put together.

Let me know if you have any queries. Thx.
+2 Reply
Thanks - it all worked fine right up to clicking "save" at the end which through an error. In the dialog box it was:

Processing script...
line 84:11 no viable alternative at input '|E|'
+1 Reply
LazyBear PRO AdrianCooper
Can u paste the 84th line here? Looks like that line got split in to 2 when u pressed ENTER.
+1 Reply
Sure: barcolor(enableBarColors ? v_color : na)

I ensured that the line was not split and have ran through the process several times with the same result.
+1 Reply
LazyBear PRO AdrianCooper
It says 11th char has an unexpected expression, which is strange. It is middle of a token. I think the problem is something else.

Will PM u to see if we can setup a screen share.
+1 Reply
In this chart, I turned the candle outlines & tails charcoal, . I also turned on the Priceline which changes color based on the newest candle. For what it's worth.
+2 Reply
perfect...looks great @grahvity. Thanks.
+2 Reply
BVI has already been posted by user kocurekc (Thanks @glaz for pointing out). Do check out Kocurekc's contributions (mainly in getsatisfaction site)...he knows his Pine :)
+1 Reply
Can't find the pine source at ?
LazyBear PRO jago25_98
Code is already in this published chart.

Try this walkthrough (PDF) to import indicators from any published chart in to your custom scripts section.
+1 Reply
Is it possible to replace the default volume indicator provided by Tradingview which is an overlay, with the better volume indicator instead of using BVI as separate indicator? I have limited screen real estate.
LazyBear PRO joe_vijay
Yes, click on "x" next to "vol" (top left in the candle chart pane). Add BVI. Once it loads, right click on "BVI" name and select "Merge up".
'Merge up' makes BVI take all the screen space in the main screen. Like this
LazyBear PRO joe_vijay
Try doing a "Screen (No scale)". If it doesnt help, cant think of anything else to try.
Have you at all updated this indicator?
LazyBear PRO rickshawTops
Sorry, dont get the question. Updated to do what?
Will this code work in Amibroker?
LazyBear PRO KeshavReddy
No Keshav. This is written in Pine script, Tradingviews proprietary language.

BVI has many amibroker implementations. Google should find you some good ones.
Hi LazyBear, please explain , what this prices means in your indicator ( ex.550.000k 283.900k)
Hi, what do you mean by (green, barcolor= blue) ? I do not see any blue bars, only cyan bars. Could you help me clarify?
Hi thank you for this indicator on tradingview. The problem I have is the indicator doesn't show anything. I have the window of the indicator but it doesn't show anything. I have this problem for all volume indicators.
MaximeCau MaximeCau
Hi there, I don't know if it is a consequence of my previous postr but I can use the better volume indicator from now on. I use FXCM as a volume data provider but the indicator doesn't show the same climax.

Here is the code :

I use the v3 version. There's one v2 and two v3 version.
Ideas Scripts Chart
United States
United Kingdom
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Account and Billing Sign Out