//version=4
study(title="VWAP and 9 EMA Cross Signals", overlay=true)
// Inputs
length = input(title="Length", type=input.integer, defval=9)
// VWAP Calculation
vwapSource = hlc3
vwapPeriod = input(title="VWAP Period", type=input.integer, defval=20)
vwap = vwma(vwapSource, vwapPeriod)
// EMA Calculation
ema = ema(close, length)
// Plot VWAP and EMA
plot(vwap, color=color.blue, linewidth=2, title="VWAP")
plot(ema, color=color.green, linewidth=2, title="EMA")
// VWAP and EMA Cross Signals
longCondition = crossover(ema, vwap)
shortCondition = crossunder(ema, vwap)
// Plot Signals
plotshape(longCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Long Signal")
plotshape(shortCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Short Signal")
study(title="VWAP and 9 EMA Cross Signals", overlay=true)
// Inputs
length = input(title="Length", type=input.integer, defval=9)
// VWAP Calculation
vwapSource = hlc3
vwapPeriod = input(title="VWAP Period", type=input.integer, defval=20)
vwap = vwma(vwapSource, vwapPeriod)
// EMA Calculation
ema = ema(close, length)
// Plot VWAP and EMA
plot(vwap, color=color.blue, linewidth=2, title="VWAP")
plot(ema, color=color.green, linewidth=2, title="EMA")
// VWAP and EMA Cross Signals
longCondition = crossover(ema, vwap)
shortCondition = crossunder(ema, vwap)
// Plot Signals
plotshape(longCondition, style=shape.triangleup, location=location.belowbar, color=color.green, size=size.small, title="Long Signal")
plotshape(shortCondition, style=shape.triangledown, location=location.abovebar, color=color.red, size=size.small, title="Short Signal")
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.