Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study(shorttitle="BB Volume", title= "vwma price" ,overlay=true)
- length = input(390, minval=1, title="Length")
- mult = input(.9, minval=0.001, maxval=5, title="Multiplier (x SD)")
- adjust = input(defval=0, type=integer, minval=-5, maxval=5, title="Adjustment (Offset)")
- mu = vwma((open + high + low + close) / 4, length)
- p_i = volume / (4 * sum(volume, length))
- var_open = sum(p_i * pow(open - mu, 2), length)
- var_high = sum(p_i * pow(high - mu, 2), length)
- var_low = sum(p_i * pow(low - mu, 2), length)
- var_close = sum(p_i * pow(close - mu, 2), length)
- sigma = sqrt(var_open + var_high + var_low + var_close)
- //Fib responds better to average true range
- atr = mult * sigma
- upper = mu + atr
- lower = mu - atr
- plot(mu, style=cross * 1 ,color=black, linewidth=1)
- upper_2= mu + (1.28*atr)
- upper_3= mu + (2.01*atr)
- upper_4= mu + (2.51*atr)
- upper_5= mu + (3.09*atr)
- p2 = plot(upper_2, style=cross, color=#abaeab, linewidth=1, title="1")
- p3 = plot(upper_3, style=cross, color=#ba4e4e, linewidth=1, title="2")
- p4 = plot(upper_4, style=cross, color=#ba4e4e, linewidth=1, title="3")
- p5 = plot(upper_5, style=cross, color=#ba4e4e, linewidth=1, title="3.09")
- lower_2= mu - (1.28*atr)
- lower_3= mu - (2.01*atr)
- lower_4= mu - (2.51*atr)
- lower_5= mu - (3.09*atr)
- p10 = plot(lower_2, style=cross, color=#abaeab, linewidth=1, title="1.28")
- p11 = plot(lower_3, style=cross, color=#419a41, linewidth=1, title="2.01")
- p12 = plot(lower_4, style=cross, color=#419a41, linewidth=1, title="2.51")
- p13 = plot(lower_5, style=cross, color=#419a41, linewidth=1, title="3.09")
- fill(p2,p5,color=#e8b5b9,transp=65)
- fill(p10,p13,color=#419a41,transp=85)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement