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}}")

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.