OPEN-SOURCE SCRIPT

RSI + MA Buy/Sell Signals

//version=5
indicator("RSI + MA Buy/Sell Signals", overlay=true)

// Inputs
rsiLength = input(14, title="RSI Length")
maLength = input(50, title="Moving Average Length")
oversold = input(30, title="Oversold Level")
overbought = input(70, title="Overbought Level")

// RSI and Moving Average
rsi = ta.rsi(close, rsiLength)
ma = ta.sma(close, maLength)

// Buy Condition
buySignal = ta.crossover(rsi, oversold) and close > ma

// Sell Condition
sellSignal = ta.crossunder(rsi, overbought) and close < ma

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

// Plot Moving Average
plot(ma, title="Moving Average", color=color.blue)

Wyłączenie odpowiedzialności