OPEN-SOURCE SCRIPT

Simple Demand Indicator v2.1 (MA + RSI)

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

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.