VWMA Fibonacci Bands (VFIBs)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jpwall

//@version=5
indicator("VWMA Fibonacci Bands (VFIBs)", overlay=true)

bars_vwma_st = input(title="VWMA (Short Term) Bars Back", defval = 20)
bars_vwma_1 = input(title="VWMA #1 Bars Back", defval=50)
bars_vwma_2 = input(title="VWMA #2 Bars Back", defval=200)
bars_vwma_lt = input(title="VWMA (Long Term) Bars Back", defval=500)
bars_atr = input(title="ATR Bars Back", defval=14)

fib_vwma1 = input(title="Outer Fibonacci (VWMA #1)", defval=6.18)
fib_vwma2 = input(title="Outer Fibonacci (VWMA #2)", defval=6.18)

vwma_st_base_color = input.color(title="VWMA (Short Term) Color", defval=color.white)
vwma1_base_color = input.color(title="VWMA #1 Main Color", defval=color.yellow)
vwma1_outer_color = input.color(title="VWMA #1 Outer Color", defval=color.yellow)
vwma2_base_color = input.color(title="VWMA #2 Main Color", defval=color.teal)
vwma2_outer_color = input.color(title="VWMA #2 Outer Color", defval=color.teal)
vwma_lt_base_color = input.color(title="VWMA (Long Term) Color", defval=color.red)


mid_2 = ta.vwma(math.avg(high, low, close), bars_vwma_2)
mid_1 = ta.vwma(math.avg(high, low, close), bars_vwma_1)
atr = ta.atr(bars_atr)

tf_vwma1 = (atr * fib_vwma1) + mid_1
bf_vwma1 = mid_1 - (atr * fib_vwma1)


tf_vwma2 = (atr * fib_vwma2) + mid_2
bf_vwma2 = mid_2 - (atr * fib_vwma2)

plot(mid_1, color=vwma1_base_color, linewidth=2)
plot(tf_vwma1, color=vwma1_outer_color)
plot(bf_vwma1, color=vwma1_outer_color)

plot(mid_2, color=vwma2_base_color, linewidth=2)
plot(tf_vwma2, color=vwma2_outer_color)
plot(bf_vwma2, color=vwma2_outer_color)

plot(ta.vwma(math.avg(high,low,close), bars_vwma_lt), color=vwma_lt_base_color)
plot(ta.vwma(math.avg(high,low,close), bars_vwma_st), color=vwma_st_base_color)