OPEN-SOURCE SCRIPT
XAUUSD Scalping System [MACD + EMA + UT Bot + LinReg]

//version=5
indicator("XAUUSD Scalping System [MACD + EMA + UT Bot + LinReg]", overlay=true)
// === INPUTS ===
fastLen = input.int(8, title="MACD Fast Length")
slowLen = input.int(21, title="MACD Slow Length")
signalLen = input.int(5, title="MACD Signal Smoothing")
linregLen = input.int(14, title="Linear Regression Length")
emaLen = input.int(21, title="EMA Length")
atrPeriod = input.int(10, title="UT Bot ATR Period")
atrMultiplier = input.float(2.0, title="UT Bot ATR Multiplier")
// === EMA ===
ema = ta.ema(close, emaLen)
plot(ema, title="21 EMA", color=color.orange, linewidth=1)
// === MACD ===
macdLine = ta.ema(close, fastLen) - ta.ema(close, slowLen)
signalLine = ta.ema(macdLine, signalLen)
hist = macdLine - signalLine
macdBull = hist > 0 and hist > hist[1]
macdBear = hist < 0 and hist < hist[1]
// === Linear Regression ===
linreg = ta.linreg(close, linregLen, 0)
bullCandle = close > linreg
bearCandle = close < linreg
barcolor(bullCandle ? color.new(color.green, 40) : bearCandle ? color.new(color.red, 40) : na)
// === UT Bot ===
atr = ta.atr(atrPeriod)
upperBand = close + atr * atrMultiplier
lowerBand = close - atr * atrMultiplier
var float trend = na
trend := na(trend[1]) ? 1 : trend[1]
trend := close > upperBand ? 1 : close < lowerBand ? -1 : trend[1]
buyUT = ta.crossover(trend, 0)
sellUT = ta.crossunder(trend, 0)
// === ENTRY CONDITIONS ===
longCondition = buyUT and bullCandle and macdBull and close > ema
shortCondition = sellUT and bearCandle and macdBear and close < ema
plotshape(longCondition, title="BUY Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", size=size.small)
plotshape(shortCondition, title="SELL Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", size=size.small)
bgcolor(longCondition ? color.new(color.green, 85) : shortCondition ? color.new(color.red, 85) : na, title="Signal Background")
// === Alerts ===
alertcondition(longCondition, title="BUY Alert", message="XAUUSD BUY setup triggered!")
alertcondition(shortCondition, title="SELL Alert", message="XAUUSD SELL setup triggered!")
indicator("XAUUSD Scalping System [MACD + EMA + UT Bot + LinReg]", overlay=true)
// === INPUTS ===
fastLen = input.int(8, title="MACD Fast Length")
slowLen = input.int(21, title="MACD Slow Length")
signalLen = input.int(5, title="MACD Signal Smoothing")
linregLen = input.int(14, title="Linear Regression Length")
emaLen = input.int(21, title="EMA Length")
atrPeriod = input.int(10, title="UT Bot ATR Period")
atrMultiplier = input.float(2.0, title="UT Bot ATR Multiplier")
// === EMA ===
ema = ta.ema(close, emaLen)
plot(ema, title="21 EMA", color=color.orange, linewidth=1)
// === MACD ===
macdLine = ta.ema(close, fastLen) - ta.ema(close, slowLen)
signalLine = ta.ema(macdLine, signalLen)
hist = macdLine - signalLine
macdBull = hist > 0 and hist > hist[1]
macdBear = hist < 0 and hist < hist[1]
// === Linear Regression ===
linreg = ta.linreg(close, linregLen, 0)
bullCandle = close > linreg
bearCandle = close < linreg
barcolor(bullCandle ? color.new(color.green, 40) : bearCandle ? color.new(color.red, 40) : na)
// === UT Bot ===
atr = ta.atr(atrPeriod)
upperBand = close + atr * atrMultiplier
lowerBand = close - atr * atrMultiplier
var float trend = na
trend := na(trend[1]) ? 1 : trend[1]
trend := close > upperBand ? 1 : close < lowerBand ? -1 : trend[1]
buyUT = ta.crossover(trend, 0)
sellUT = ta.crossunder(trend, 0)
// === ENTRY CONDITIONS ===
longCondition = buyUT and bullCandle and macdBull and close > ema
shortCondition = sellUT and bearCandle and macdBear and close < ema
plotshape(longCondition, title="BUY Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", size=size.small)
plotshape(shortCondition, title="SELL Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", size=size.small)
bgcolor(longCondition ? color.new(color.green, 85) : shortCondition ? color.new(color.red, 85) : na, title="Signal Background")
// === Alerts ===
alertcondition(longCondition, title="BUY Alert", message="XAUUSD BUY setup triggered!")
alertcondition(shortCondition, title="SELL Alert", message="XAUUSD SELL setup triggered!")
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.