OPEN-SOURCE SCRIPT

Enhanced Buy/Sell Signals

101
//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!")

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.