VWAP + EMA Analysis [Joshlo]
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Joshlo

//@version=5
indicator("VWAP Analysis", overlay=true)

ioDailyVWAP = input.bool(true, "Daily VWAP", group="VWAP")
ioWeeklyVWAP = input.bool(false, "Weekly VWAP", group="VWAP")
ioMonthlyVWAP = input.bool(false, "Monthly VWAP", group="VWAP")


stdevMultiplierInput = input.float(2.0, "Standard Deviation Multiplier", group="VWAP")

vwapDColor = input.color(color.rgb(0,100,245,0), "VWAP Equilibrium (Daily)", group="VWAP")
vwapDResistanceColor = input.color(color.rgb(255,0,0,0), "VWAP Resistance (Daily)", group="VWAP")
vwapDSupportColor = input.color(color.rgb(0,255,0,0), "VWAP Support (Daily)", group="VWAP")

vwapWColor = input.color(color.rgb(0,100,245,30), "VWAP Equilibrium (Weekly)", group="VWAP")
vwapWResistanceColor = input.color(color.rgb(255,0,0,30), "VWAP Resistance (Weekly)", group="VWAP")
vwapWSupportColor = input.color(color.rgb(0,255,0,30), "VWAP Support (Weekly)", group="VWAP")

vwapMColor = input.color(color.rgb(0,100,245,80), "VWAP Equilibrium (Monthly)", group="VWAP")
vwapMResistanceColor = input.color(color.rgb(255,0,0,80), "VWAP Resistance (Monthly)", group="VWAP")
vwapMSupportColor = input.color(color.rgb(0,255,0,80), "VWAP Support (Monthly)", group="VWAP")


io200 = input.bool(true, "200 EMA", group="Exponential Moving Averages")
emaColor1 = input.color(color.orange, "200 EMA Color", group="Exponential Moving Averages")
io50 = input.bool(true, "50 EMA", group="Exponential Moving Averages")
emaColor2 = input.color(color.purple, "50 EMA Color", group="Exponential Moving Averages")
io20 = input.bool(true, "20 EMA", group="Exponential Moving Averages")
emaColor3 = input.color(color.white, "20 EMA Color", group="Exponential Moving Averages")


anchorD = timeframe.change("1D")
[vwapD, upperD, lowerD] = ta.vwap(close, anchorD, stdevMultiplierInput)

anchorW = timeframe.change("1W")
[vwapW, upperW, lowerW] = ta.vwap(close, anchorW, stdevMultiplierInput)

anchorM = timeframe.change("1M")
[vwapM, upperM, lowerM] = ta.vwap(close, anchorM, stdevMultiplierInput)


plot(ioDailyVWAP ? vwapD : na, color = vwapDColor ,title="VWAP Equilibrium (Daily)", editable=true)
plot(ioDailyVWAP ? upperD : na, color = vwapDResistanceColor,title="VWAP Resistance (Daily)", editable=true)
plot(ioDailyVWAP ? lowerD : na, color = vwapDSupportColor,title="VWAP Support (Daily)", editable=true)

plot(ioWeeklyVWAP ? vwapW : na, color = vwapWColor ,title="VWAP Equilibrium (Weekly)", style=plot.style_circles, editable=true)
plot(ioWeeklyVWAP ? upperW : na, color = vwapWResistanceColor,title="VWAP Resistance (Weekly)", style=plot.style_circles,editable=true)
plot(ioWeeklyVWAP ? lowerW : na, color = vwapWSupportColor,title="VWAP Support (Weekly)", style=plot.style_circles,editable=true)

plot(ioMonthlyVWAP ? vwapM : na, color = vwapMColor ,title="VWAP Equilibrium (Monthly)", style=plot.style_stepline_diamond,editable=true)
plot(ioMonthlyVWAP ? upperM : na, color = vwapMResistanceColor,title="VWAP Resistance (Monthly)", style=plot.style_stepline_diamond,editable=true)
plot(ioMonthlyVWAP ? lowerM : na, color = vwapMSupportColor,title="VWAP Support (Monthly)", style=plot.style_stepline_diamond,editable=true)


plot(io200 ? ta.ema(close,200) : na, color = emaColor1, linewidth=1,title="200 EMA", editable=true)
plot(io50 ? ta.ema(close,50) : na, color = emaColor2, linewidth=1,title="50 EMA", editable=true)
plot(io20 ? ta.ema(close,20) : na, color = emaColor3, linewidth=1,title="20 EMA", editable=true)