OPEN-SOURCE SCRIPT

Enhanced Buy/Sell Signals

92
//version=5
indicator("Enhanced Buy/Sell Signals", overlay=true)

// Parameters
lengthRSI = input(14, title="RSI Length")
lengthSMA = input(50, title="SMA Length")
overbought = input(70, title="Overbought Level")
oversold = input(30, title="Oversold Level")
fastLength = input(12, title="MACD Fast Length")
slowLength = input(26, title="MACD Slow Length")
signalSmoothing = input(9, title="MACD Signal Smoothing")

// Indicators
rsi = ta.rsi(close, lengthRSI)
sma = ta.sma(close, lengthSMA)
[macdLine, signalLine, _] = ta.macd(close, fastLength, slowLength, signalSmoothing)

// Buy/Sell Conditions
buySignal = ta.crossover(rsi, oversold) and close > sma and ta.crossover(macdLine, signalLine)
sellSignal = ta.crossunder(rsi, overbought) and close < sma and ta.crossunder(macdLine, signalLine)

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

// Alerts
alertcondition(buySignal, title="Buy Signal", message="Buy signal detected!")
alertcondition(sellSignal, title="Sell Signal", message="Sell signal detected!")

Pernyataan Penyangkalan

Informasi dan publikasi tidak dimaksudkan untuk menjadi, dan bukan merupakan saran keuangan, investasi, perdagangan, atau rekomendasi lainnya yang diberikan atau didukung oleh TradingView. Baca selengkapnya di Persyaratan Penggunaan.