OPEN-SOURCE SCRIPT

Altangadas Megad

66
//version=5
indicator("VWAP/MVWAP/EMA Precise Final", overlay = true)

// --- 1. Signal Settings ---
vwapLength = input.int(1, title="VWAP Length", minval=1)
emaLength1 = input.int(7, title="Signal EMA 1 (7)", minval=1)
emaLength2 = input.int(25, title="Signal EMA 2 (25)", minval=1)
mvwapLength = input.int(21, title="MVWAP Length", minval=1)

// --- RSI Settings ---
rsiLength = input.int(14, title="RSI Length")
rsiLimit = input.int(70, title="RSI Filter Level")

// --- 2. Trend EMA Settings ---
ema50Length = input.int(50, title="Trend EMA 50")
ema100Length = input.int(100, title="Trend EMA 100")
ema200Length = input.int(200, title="Trend EMA 200")
ema800Length = input.int(800, title="Institutional EMA 800")

// --- Calculations ---
vwapValue = ta.vwap(hlc3)
cvwap = ta.ema(vwapValue, vwapLength)
mvwap = ta.ema(vwapValue, mvwapLength)
rsiValue = ta.rsi(close, rsiLength)

ema1 = ta.ema(close, emaLength1)
ema2 = ta.ema(close, emaLength2)
ema50 = ta.ema(close, ema50Length)
ema100 = ta.ema(close, ema100Length)
ema200 = ta.ema(close, ema200Length)
ema800 = ta.ema(close, ema800Length)

// --- Plotting Lines ---
plot(cvwap, color=color.blue, linewidth=2, title="VWAP", style=plot.style_linebr)
plot(mvwap, color=color.fuchsia, linewidth=2, title="MVWAP", style=plot.style_linebr)
plot(ema1, color=color.new(color.yellow, 50), title="EMA 7")
plot(ema2, color=color.new(color.orange, 50), title="EMA 25")
plot(ema50, color=color.green, linewidth=1, title="EMA 50")
plot(ema100, color=color.blue, linewidth=1, title="EMA 100")
plot(ema200, color=color.gray, linewidth=2, title="EMA 200")
plot(ema800, color=color.yellow, linewidth=4, title="EMA 800")

// --- Signal Logic (Анхны огтлолцол дээр нэг удаа сигнал өгөх) ---
// LONG: EMA болон VWAP бүгд MVWAP-аас дээш гарахад
longCond = (ema1 > mvwap) and (ema2 > mvwap) and (cvwap > mvwap)
// SHORT: EMA болон VWAP бүгд MVWAP-аас доош ороход
shortCond = (ema1 < mvwap) and (ema2 < mvwap) and (cvwap < mvwap)

// Зөвхөн төлөв өөрчлөгдөх мөчийг барих
longTrigger = longCond and not longCond[1] and (rsiValue < rsiLimit)
shortTrigger = shortCond and not shortCond[1] and (rsiValue > (100 - rsiLimit))

// --- Tiny Signals ---
plotshape(longTrigger, title="L", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.tiny, text="L")
plotshape(shortTrigger, title="S", location=location.abovebar, color=color.red, style=shape.triangledown, size=size.tiny, text="S")

// --- Alerts ---
alertcondition(longTrigger, title="Long Alert", message="XAUUSD: LONG!")
alertcondition(shortTrigger, title="Short Alert", message="XAUUSD: SHORT!")

إخلاء المسؤولية

لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.