OPEN-SOURCE SCRIPT

FRX_FORTUNE - EMA 9/15 Crossover Alert

150
//version=5
indicator("FRX_FORTUNE - EMA 9/15 Crossover Alert", overlay=true)

// === INPUTS ===
fastEmaLength = input.int(9, title="Fast EMA (9)")
slowEmaLength = input.int(15, title="Slow EMA (15)")
showArrows = input.bool(true, title="Show Buy/Sell Arrows")
enableAlerts = input.bool(true, title="Enable Alerts")

// === CALCULATIONS ===
fastEma = ta.ema(close, fastEmaLength)
slowEma = ta.ema(close, slowEmaLength)

bullishCross = ta.crossover(fastEma, slowEma)
bearishCross = ta.crossunder(fastEma, slowEma)

// === PLOT EMA ===
plot(fastEma, title="EMA 9", color=color.orange)
plot(slowEma, title="EMA 15", color=color.blue)

// === DRAW ARROWS ===
plotshape(bullishCross and showArrows, location=location.belowbar, color=color.green, style=shape.labelup, text="BUY", size=size.small)
plotshape(bearishCross and showArrows, location=location.abovebar, color=color.red, style=shape.labeldown, text="SELL", size=size.small)

// === ALERTS ===
alertcondition(bullishCross, title="Buy Alert", message="BUY: EMA 9 crossed above EMA 15")
alertcondition(bearishCross, title="Sell Alert", message="SELL: EMA 9 crossed below EMA 15")

Disclaimer

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.