// Buy Condition: RSI is oversold and MACD line crosses above Signal line buyCondition = (rsi < rsiOversold) and (ta.crossover(macdLine, signalLine))
// Sell Condition: RSI is overbought and MACD line crosses below Signal line sellCondition = (rsi > rsiOverbought) and (ta.crossunder(macdLine, signalLine))
// Plotting Buy and Sell signals on the chart plotshape(series=buyCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", size=size.small) plotshape(series=sellCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", size=size.small)
// Plot MACD and Signal Line (optional, for visualization) hline(0, "Zero Line", color=color.gray) plot(macdLine, color=color.blue, title="MACD Line") plot(signalLine, color=color.orange, title="Signal Line")
// Alerts for Buy and Sell signals alertcondition(buyCondition, title="Buy Alert", message="BUY signal generated") alertcondition(sellCondition, title="Sell Alert", message="SELL signal generated")
Protected script
This script is published as closed-source. However, you can use it freely and without any limitations – learn more here.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.