TradingView
Lemrin
Apr 4, 2018 10:30 PM

BTCUSD Combined Volume 

Bitcoin / TetherBittrex

Description

This script sums the volume for BTCUSD across several popular exchanges. I share it not so much as an indicator as a tool to use in other indicators (i.e. those that rely on volume, which often do not work very well for crypto due to the low volumes). Similar sums could easily be created for other currency, and with a little thought I could probably add the ability to parameterize the currency (e.g. type "BTCUSD" or "ETHBTC" or "LTCUSD" or whatever as an input).

I got the idea from seeing someone asking in chat whether it is possible to combine volumes across multiple exchanges, so kudos to oh92 and paaax for the neat idea.

Please feel free to incorporate this in your own indicators as you like...and of course if you're feeling generous, tips are appreciated. Thank you!

BTC
3KmFchJ18QvMzAJKDcFQXvyK9p1EHWQdhP
BCH
qqtrw64ptuwprk5vtj3z8qwkvh3v0jawxq7khqng7x
ETH
0x9b51361A278910Ba3945C7519C9f0FA8a77df18d
LTC
MDeWWsP7XCG2zQuZ2dYALZXQ52u2qkc8fh

Release Notes

V41: Added Gemini; allowed further lookback to the earliest exchange that has data available; added indication as each subsequent exchange's data becomes incorporated.
Comments
Pladizow
Looks great. I've noticed the data only goes back to Aug 16th, 2017.

Any way to have it go back further by altering the script to add up the volume on exchanges that do have longer histories?
Lemrin
@Pladizow, Thank you. There is nothing in the code itself that imposes a time limit (note that it is open-source), so probably this Aug 16th, 2017 date is the maximum lookback of whatever chart you happen to be using, at a given time frame, here on TradingView.
Pladizow
@Lemrin, Thanks for the reply. What helped was to unselect Binance for an input. This allowed the data to go back much further. Additionally, I took the liberty of adding Gemini to the Pine Script. However, for some reason I could not get the code to work when I added Bitmex? Any thoughts?
Lemrin
@Pladizow, Ahh, good test--I see the problem. The volume series is na prior to the start of that exchanges history. The fix is simple: wrap each individual volume term in an nz() function, leaving the default value at 0 (no need to specify it).

What I'd suggest after that is to add an indication each time a new exchange's volume kicks in, as otherwise there will likely be an unexplained jump in combined volume. This is just typed here and untested in a chart, but here's a first idea, just done for one exchange as an example:

bitfinex_start = na(BTCUSD_Bitfinex_volume[1]) and not na(BTCUSD_Bitfinex_volume)
plotchar(bitfinex_start,char="*",text="Begin Bitfinex History",textcolor=black,location=location.top,color=lime,size=size.small)

***I'd use a unicode triangle or something as the char, but commenting won't allow that here.
Lemrin
Bah, I think the commenting system ate my square brackets. Add them to the first operand of the and statement:
bitfinex_start = na(BTCUSD_Bitfinex_volumeOPENSQUAREBRACKET 1 CLOSESQUAREBRACKET) and not na(BTCUSD_Bitfinex_volume)

lol
Pladizow
@Lemrin, Thanks. I was able to figure out copy and paste in order to add Gemini but the ability to make those changes to Pine Script are well beyond my knowledge.
Lemrin
@Pladizow, Oh ok, no problem. It should be quick, so I'll just revise here.
Pladizow
@Lemrin, Cool thanks. Can you also take a look at adding Gemini and Bitmex as exchange inputs.
Lemrin
@Pladizow, Bitmex I intentionally left out because TV interprets their swap volume as vastly higher than other volumes. I'll add them when/if I revisit this thing to address a to-do comment I just added (convert it to an oscillator of some sort and have each exchange's volume reference its past volume, so that all exchanges can contribute equally. Alternately, rather than an alternator, I suppose I could normalize each exchange's volume....
Pladizow
@Lemrin, Makes sense. Also, I don't know if this is possible but something that converts the Korean exchanges Won volume to $'s, so that the Korean volume can be added in.
More