Iskandar ok//@version=5
indicator("Custom Crypto Indicator", shorttitle="CCI", overlay=true)
// Input parameters
fastLength = input.int(12, minval=1, title="Fast EMA Length")
slowLength = input.int(26, minval=1, title="Slow EMA Length")
signalLength = input.int(9, minval=1, title="Signal Line Length")
rsiLength = input.int(14, minval=1, title="RSI Length")
rsiOverbought = input.int(70, minval=50, maxval=100, title="RSI Overbought Level")
rsiOversold = input.int(30, minval=0, maxval=50, title="RSI Oversold Level")
// MACD calculation
= ta.macd(close, fastLength, slowLength, signalLength)
// RSI calculation
rsi = ta.rsi(close, rsiLength)
// Signals
longSignal = ta.crossover(macdLine, signalLine) and rsi < rsiOversold
shortSignal = ta.crossunder(macdLine, signalLine) and rsi > rsiOverbought
// Plotting
plot(macdLine, color=color.new(color.blue, 0), linewidth=2, title="MACD Line")
plot(signalLine, color=color.new(color.red, 0), linewidth=2, title="Signal Line")
hline(0, "Zero Line", color=color.gray)
bgcolor(longSignal ? color.new(color.green, 90) : na)
bgcolor(shortSignal ? color.new(color.red, 90) : na)
// Alerts
alertcondition(longSignal, title="Long Signal", message="MACD and RSI indicate a Long entry")
alertcondition(shortSignal, title="Short Signal", message="MACD and RSI indicate a Short entry")