OPEN-SOURCE SCRIPT

Combined Entry Signal - SMI + MACD + EMA + Volume

298
//version=5
indicator("Combined Entry Signal - SMI + MACD + EMA + Volume", overlay=true)

// ==== INPUTS ====
smiK = input.int(5, "SMI K", minval=1)
smiD = input.int(3, "SMI D", minval=1)
macdFast = input.int(12, "MACD Fast")
macdSlow = input.int(26, "MACD Slow")
macdSignal = input.int(9, "MACD Signal")
emaShort = input.int(20, "EMA Short")
emaMid = input.int(50, "EMA Mid")
emaLong = input.int(100, "EMA Long")
volMult = input.float(1.2, "Volume Multiplier for Confirm")

// ==== SMI ====
smiSource = close
smi = ta.stoch(close, high, low, smiK)
smiSignal = ta.sma(smi, smiD)

// ==== MACD ====
[macdLine, signalLine, macdHist] = ta.macd(close, macdFast, macdSlow, macdSignal)
macdCrossUp = ta.crossover(macdLine, signalLine)
macdCrossDown = ta.crossunder(macdLine, signalLine)

// ==== EMA Trend ====
emaS = ta.ema(close, emaShort)
emaM = ta.ema(close, emaMid)
emaL = ta.ema(close, emaLong)
trendUp = close > emaS and emaS > emaM and emaM > emaL
trendDown = close < emaS and emaS < emaM and emaM < emaL

// ==== Volume confirmation ====
avgVol = ta.sma(volume, 20)
volConfirm = volume > avgVol * volMult

// ==== BUY/SELL CONDITIONS ====
smiBuy = smi > smiSignal and smi < 20
smiSell = smi < smiSignal and smi > 80

buySignal = smiBuy and macdCrossUp and trendUp and volConfirm
sellSignal = smiSell and macdCrossDown and trendDown and volConfirm

// ==== PLOTS ====
plotshape(buySignal, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY")
plotshape(sellSignal, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL")

plot(emaS, title="EMA 20", color=color.orange)
plot(emaM, title="EMA 50", color=color.green)
plot(emaL, title="EMA 100", color=color.blue)

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。