Diabolicus

BTC Volume Index 1.1 beta [Dia]

174 0 11
Indicator calculates total volume across multiple bitcoin exchanges. The influence of each exchange can be adjusted seperately.
0 fee exchanges default to 50%
0 fee futures default to 10%
Define custom lookback periods for price breakout detection.
Look for low-volume price reversals in those candles immediately following high volume peaks. The lower the volume and the greater the open/close price difference of that 2nd candle is compared to the previous one, the higher the likelihood of a local top/bottom being in.

Note:
Bar highlighting is still experimental, future versions will include better filtering options.
Use for confirmation only, not as standalone trading system.
Remove from Favorite Scripts Add to Favorite Scripts
study(title="BTC Volume Index 1.1 [Dia]", shorttitle="BTCVx_Dia", overlay=false)
//
// 150911 v1.0 
// calculate total volume across exchanges, influence of exchanges weighted individually
// 0 fee exchanges default to 50%
// 0 fee futures default to 10%
// 150915 v1.1
// define custom long / short lookback periods to identify peak buy / sell activity
// light green / red = above average volume & price above / below short lookback period
// dark green / red =  above average volume & price above / below long lookback period
// look for price reversals following high volume peaks
//
slow_ma = input(100,title="Volume Slow SMA")
fast_ma = input(3,title="Volume Fast EMA")
long_lb = input(10,title="Long Lookback Period")
short_lb = input(5,title="Short Lookback Period")
lb = input(true,title="Highlight High Volume Peaks?")
s_okcs = input(defval=0.5,minval=0,maxval=1,step=0.1, title="Include OKCoin USD Spot?")
s_okc1 = input(defval=0.1,minval=0,maxval=1,step=0.1, title="Include OKCoin USD 1W Future?")
s_okc2 = input(defval=0.1,minval=0,maxval=1,step=0.1, title="Include OKCoin USD 2W Future?")
s_okc3 = input(defval=0.1,minval=0,maxval=1,step=0.1, title="Include OKCoin USD 3M Future?")
s_okccs = input(defval=0.5,minval=0,maxval=1,step=0.1, title="Include OKCoin CNY Spot?")
s_btcchina = input(defval=0.5,minval=0,maxval=1,step=0.1, title="Include BTCCHina CNY?")
s_huobi = input(defval=0.5,minval=0,maxval=1,step=0.1, title="Include Huobi CNY?")
s_stamp = input(defval=1,minval=0,maxval=1,step=0.1, title="Include Bitstamp USD?")
s_bfx = input(defval=1,minval=0,maxval=1,step=0.1, title="Include Bitfinex USD?")
s_btce = input(defval=1,minval=0,maxval=1,step=0.1, title="Include BTC-E USD?")
s_btcee = input(defval=1,minval=0,maxval=1,step=0.1, title="Include BTC-E EUR?")
s_kraken = input(defval=1,minval=0,maxval=1,step=0.1, title="Include Kraken EUR?")

sym_v(s)=>security(s,period,volume)
sym_h(s)=>security(s,period,high)
sym_l(s)=>security(s,period,low)

// Exchange pairs must be normalized to USD, so multiply by EURUSD or divide by USDCNH respectively
okc_sv = sym_v("OKCOIN:BTCUSD")
okc_1v = sym_v("OKCOIN:BTCUSD1W")
okc_2v = sym_v("OKCOIN:BTCUSD2W")
okc_3v = sym_v("OKCOIN:BTCUSD3M")
okcc_sv = sym_v("OKCOIN:BTCCNY")
btcchina_sv = sym_v("BTCCHINA:BTCCNY")
huobi_sv = sym_v("HUOBI:BTCCNY")
stamp_sv = sym_v("BITSTAMP:BTCUSD")
bfx_sv = sym_v("BITFINEX:BTCUSD")
btce_sv = sym_v("BTCE:BTCUSD")
btcee_sv = sym_v("BTCE:BTCEUR")
kraken_sv = sym_v("KRAKEN:XBTEUR")

//calculate total volume
total_v =(okc_sv*s_okcs+okc_1v*s_okc1+okc_2v*s_okc2+okc_3v*s_okc3+okcc_sv*s_okccs+btcchina_sv*s_btcchina+huobi_sv*s_huobi+stamp_sv*s_stamp+bfx_sv*s_bfx+btce_sv*s_btce+btcee_sv*s_btcee+kraken_sv*s_kraken)

okc_sh = sym_h("OKCOIN:BTCUSD")
okc_1h = sym_h("OKCOIN:BTCUSD1W")
okc_2h = sym_h("OKCOIN:BTCUSD2W")
okc_3h = sym_h("OKCOIN:BTCUSD3M")
okcc_sh = sym_h("OKCOIN:BTCCNY")
btcchina_sh = sym_h("BTCCHINA:BTCCNY")
huobi_sh = sym_h("HUOBI:BTCCNY")
stamp_sh = sym_h("BITSTAMP:BTCUSD")
bfx_sh = sym_h("BITFINEX:BTCUSD")
btce_sh = sym_h("BTCE:BTCUSD")
btcee_sh = sym_h("BTCE:BTCEUR")
kraken_sh = sym_h("KRAKEN:XBTEUR")

//calculate mean high
mean_h =(okc_sh*s_okcs+okc_1h*s_okc1+okc_2h*s_okc2+okc_3h*s_okc3+okcc_sh*s_okccs+btcchina_sh*s_btcchina+huobi_sh*s_huobi+stamp_sh*s_stamp+bfx_sh*s_bfx+btce_sh*s_btce+btcee_sh*s_btcee+kraken_sh*s_kraken)

okc_sl = sym_l("OKCOIN:BTCUSD")
okc_1l = sym_l("OKCOIN:BTCUSD1W")
okc_2l = sym_l("OKCOIN:BTCUSD2W")
okc_3l = sym_l("OKCOIN:BTCUSD3M")
okcc_sl = sym_l("OKCOIN:BTCCNY")
btcchina_sl = sym_l("BTCCHINA:BTCCNY")
huobi_sl = sym_l("HUOBI:BTCCNY")
stamp_sl = sym_l("BITSTAMP:BTCUSD")
bfx_sl = sym_l("BITFINEX:BTCUSD")
btce_sl = sym_l("BTCE:BTCUSD")
btcee_sl = sym_l("BTCE:BTCEUR")
kraken_sl = sym_l("KRAKEN:XBTEUR")

//calculate mean low
mean_l =(okc_sl*s_okcs+okc_1l*s_okc1+okc_2l*s_okc2+okc_3l*s_okc3+okcc_sl*s_okccs+btcchina_sl*s_btcchina+huobi_sl*s_huobi+stamp_sl*s_stamp+bfx_sl*s_bfx+btce_sl*s_btce+btcee_sl*s_btcee+kraken_sl*s_kraken)

// logic
range = mean_h-mean_l
long_lb_h = highest(mean_h[1],long_lb)
long_lb_l = lowest(mean_l[1],long_lb)
long_highpercent = mean_h > long_lb_h ? lb*(mean_h-long_lb_h)/range : 0
long_lowpercent  = mean_l < long_lb_l ? lb*(long_lb_l-mean_l)/range : 0
short_lb_h = highest(mean_h[1],short_lb)
short_lb_l = lowest(mean_l[1],short_lb)
short_highpercent = mean_h > short_lb_h ? lb*(mean_h-short_lb_h)/range : 0
short_lowpercent  = mean_l < short_lb_l ? lb*(short_lb_l-mean_l)/range : 0

// plot values
total_vol = plot(total_v,color=#FFAA22,style=columns,transp=20)
short_low_vol  = plot(-total_v*short_lowpercent,color=#FF4444,style=columns,transp=20)
short_high_vol = plot(total_v*short_highpercent,color=#44FF44,style=columns,transp=20)
long_low_vol  = plot(-total_v*long_lowpercent,color=red,style=columns,transp=20)
long_high_vol = plot(total_v*long_highpercent,color=green,style=columns,transp=20)
barcolor=barcolor(total_v*long_highpercent > sma(total_v,slow_ma) ? green : total_v*long_lowpercent > sma(total_v,slow_ma) ? red : na)
total_vol_fast_ma = plot(ema(total_v,fast_ma),color=#FF0000,linewidth=1,style=area,transp=90)
total_vol_slow_ma = plot(sma(total_v,slow_ma),color=#0000AA,linewidth=1)
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener 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 Billing Sign Out