9 ema and vwap crossover

47
//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")

คำจำกัดสิทธิ์ความรับผิดชอบ

ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน