OPEN-SOURCE SCRIPT

RSI Oversold & Golden Cross

//version=5
indicator("RSI Oversold & Golden Cross", overlay=true)

// Input settings
rsiLength = input.int(14, title="RSI Length")
rsiOversold = input.int(30, title="RSI Oversold Level")
shortEmaLength = input.int(50, title="Short EMA Length")
longEmaLength = input.int(200, title="Long EMA Length")

// Calculate RSI
rsi = ta.rsi(close, rsiLength)

// Calculate EMAs
shortEma = ta.ema(close, shortEmaLength)
longEma = ta.ema(close, longEmaLength)

// Golden Cross condition
goldenCross = ta.crossover(shortEma, longEma)

// RSI Oversold condition
rsiOversoldCondition = rsi < rsiOversold

// Combined condition
signal = goldenCross and rsiOversoldCondition

// Plot EMA lines
plot(shortEma, color=color.blue, title="Short EMA")
plot(longEma, color=color.orange, title="Long EMA")

// Plot buy signals
plotshape(series=signal, location=location.belowbar, color=color.green, style=shape.labelup, title="Buy Signal", text="BUY")

// Background color for RSI Oversold
bgcolor(rsiOversoldCondition ? color.new(color.green, 90) : na, title="RSI Oversold Background")

// Alert conditions
alertcondition(signal, title="Golden Cross + RSI Oversold", message="Golden Cross + RSI Oversold detected!")

כתב ויתור