OPEN-SOURCE SCRIPT

Simple Demand Indicator v2.1 (MA + RSI)

43
//version=5
indicator("Simple Demand Indicator v2.1 (MA + RSI)", overlay=true)

// === INPUT ===
maLength = input.int(50, "Moving Average Length")
rsiLength = input.int(14, "RSI Length")
overSold = input.int(30, "RSI Oversold")
overBought = input.int(70, "RSI Overbought")

// === CALCULATION ===
ma = ta.sma(close, maLength)
rsi = ta.rsi(close, rsiLength)

// BUY: harga cross up MA + RSI oversold
buySignal = ta.crossover(close, ma) and rsi < overSold

// SELL: harga cross down MA + RSI overbought
sellSignal = ta.crossunder(close, ma) and rsi > overBought

// === PLOT MA ===
plot(ma, color=color.orange, title="MA Trend")

// === PLOT SIGNAL ARROWS ===
plotshape(buySignal, title="BUY Signal", style=shape.labelup, color=color.green,
text="BUY", textcolor=color.white, size=size.small, location=location.belowbar)

plotshape(sellSignal, title="SELL Signal", style=shape.labeldown, color=color.red,
text="SELL", textcolor=color.white, size=size.small, location=location.abovebar)

// === ALERTS ===
alertcondition(buySignal, title="BUY Signal", message="📈 BUY Signal pada {{ticker}} TF {{interval}}")
alertcondition(sellSignal, title="SELL Signal", message="📉 SELL Signal pada {{ticker}} TF {{interval}}")

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。