//@version=5
indicator(title="[preset] 2 MA Cross", overlay=true, timeframe="", timeframe_gaps=true)
shortlen = input.int(9, "Short MA Length", minval=1)
longlen = input.int(21, "Long MA Length", minval=1)
short = ta.sma(close, shortlen)
long = ta.sma(close, longlen)
plot(short, color = #FF6D00, display = display.pane)
plot(long, color = #43A047, display = display.pane)
buy = ta.crossover(short, long)
sell = ta.crossunder(short, long)
signal = buy ? 1 : sell ? -1 : na
plotshape(buy, '', shape.labelup, location.belowbar, color.green, 0, 'BUY', color.black, display = display.pane)
plotshape(sell, '', shape.labeldown, location.abovebar, color.red, 0, 'SELL', color.black, display = display.pane)
plot(signal, 'Signal', display = display.data_window)