//@version=5 indicator("UT Bot + EMA Strategy [Combined]", overlGold / U.S. DollarFOREXCOM:XAUUSDSajad_pourkarim//@version=5 indicator("UT Bot + EMA Strategy ", overlay=true) // تنظیمات EMA emaLength = input.int(21, title="EMA Length") emaValue = ta.ema(close, emaLength) // تنظیمات UT Bot keyVal = input.float(1.0, title="Key Value (Sensitivity)") atrPeriod = input.int(10, title="ATR Period") xATR = ta.atr(atrPeriod) nLoss = keyVal * xATR // محاسبات UT Bot var float xATRTrailingStop = 0.0 xATRTrailingStop := (close > nz(xATRTrailingStop, 0) and close > nz(xATRTrailingStop, 0)) ? math.max(nz(xATRTrailingStop, 0), close - nLoss) : (close < nz(xATRTrailingStop, 0) and close < nz(xATRTrailingStop, 0)) ? math.min(nz(xATRTrailingStop, 0), close + nLoss) : (close > nz(xATRTrailingStop, 0)) ? close - nLoss : close + nLoss // شرایط ورود buySignal = ta.crossover(close, xATRTrailingStop) and close > emaValue sellSignal = ta.crossunder(close, xATRTrailingStop) and close < emaValue // رسم روی چارت plot(emaValue, color=color.blue, linewidth=2, title="EMA") plotshape(buySignal, title="Buy Signal", style=shape.labelup, location=location.belowbar, color=color.green, text="BUY", textcolor=color.white) plotshape(sellSignal, title="Sell Signal", style=shape.labeldown, location=location.abovebar, color=color.red, text="SELL", textcolor=color.white) // هشدار (Alert) alertcondition(buySignal, title="Buy Alert", message="سیگنال خرید در XAUUSD") alertcondition(sellSignal, title="Sell Alert", message="سیگنال فروش در XAUUSD")