Bitcoin Support Bands
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Ryukobushi

//@version=4

study(title="Bitcoin Weekly Support Bands", overlay=true, resolution="W")

src = input(hl2, title="Source")

len0 = input(4, minval=1, title="4sma")
out0 = sma(src, len0)
len1 = input(4, minval=1, title="4ema")
out1 = ema(src, len1)
len2 = input(12, minval=1, title="12sma")
out2 = sma(src, len2)
len3 = input(12, minval=1, title="12ema")
out3 = ema(src, len3)
len4 = input(24, minval=1, title="24sma")
out4 = sma(src, len4)
len5 = input(24, minval=1, title="24ema")
out5 = ema(src, len5)
len6 = input(48, minval=1, title="48sma")
out6 = sma(src, len6)
len7 = input(48, minval=1, title="48ema")
out7 = ema(src, len7)
len8 = input(96, minval=1, title="96sma")
out8 = sma(src, len8)
len9 = input(96, minval=1, title="96ema")
out9 = ema(src, len9)
len10 = input(192, minval=1, title="192sma")
out10 = sma(src, len10)
len11 = input(192, minval=1, title="192ema")
out11 = ema(src, len11)
len12 = input(384, minval=1, title="384sma")
out12 = sma(src, len12)
len13 = input(384, minval=1, title="384ema")
out13 = ema(src, len13)

o0 = plot(out0, linewidth=2, color=color.silver, title="6sma")
o1 = plot(out1, linewidth=2, color=color.white, title="4ema")
o2 = plot(out2, linewidth=2, color=color.orange, title="16sma")
o3 = plot(out3, linewidth=2, color=color.red, title="14ema")
o4 = plot(out4, linewidth=2, color=color.olive, title="30sma")
o5 = plot(out5, linewidth=2, color=color.yellow, title="28ema")
o6 = plot(out6, linewidth=2, color=color.green, title="52sma")
o7 = plot(out7, linewidth=2, color=color.lime, title="50ema")
o8 = plot(out8, linewidth=2, color=color.blue, title="90sma")
o9 = plot(out9, linewidth=2, color=color.aqua, title="88ema")
o10 = plot(out10, linewidth=2, color=color.maroon, title="150sma")
o11 = plot(out11, linewidth=2, color=color.navy, title="148ema")
o12 = plot(out12, linewidth=2, color=color.fuchsia, title="300sma")
o13 = plot(out13, linewidth=2, color=color.purple, title="298ema")

fill(o0, o1, color=color.white)
fill(o2, o3, color=color.white)
fill(o4, o5, color=color.white)
fill(o6, o7, color=color.white)
fill(o8, o9, color=color.white)
fill(o10,o11, color=color.white)
fill(o12,o13, color=color.white)