//@version=5
indicator("My Custom Indicator", shorttitle="MCI", overlay=true)
// Input parameters
length = input.int(14, title="Period Length", minval=1, maxval=100)
source = input.source(close, title="Source")
showSignals = input.bool(true, title="Show Buy/Sell Signals")
// Color inputs
bullishColor = input.color(color.green, title="Bullish Color")
bearishColor = input.color(color.red, title="Bearish Color")
// Calculate moving averages
fastMA = ta.sma(source, length)
slowMA = ta.sma(source, length * 2)
// Calculate RSI for additional signals
rsi = ta.rsi(source, length)
// Define conditions
bullishCondition = ta.crossover(fastMA, slowMA) and rsi < 70
bearishCondition = ta.crossunder(fastMA, slowMA) and rsi > 30
// Plot moving averages
plot(fastMA, color=color.blue, linewidth=2, title="Fast MA")
plot(slowMA, color=color.orange, linewidth=2, title="Slow MA")
// Plot buy/sell signals
plotshape(
series=bullishCondition and showSignals,
title="Buy Signal",