//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")
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。