indicator · on price · open source
Exponential Moving Average
Running…
Loading chart…
About
Exponential Moving Average weights recent bars more heavily than older ones. Reacts to turns faster than an SMA at the same length and stays smooth through chop.
- The classic 9/21 EMA crossover is a battle-hardened short-term trend signal.
- Raise N for a steadier line, lower it for tighter, noisier response.
- Use on any timeframe; close + 21 is the textbook default.
Source code
//@version=5
indicator("Exponential Moving Average", overlay=true)
len = input.int(21, "Length", minval=1, maxval=500)
src = input.source("close", "Source")
ema = ta.ema(src, len)
p_EMA = plot(ema, "EMA", color=color.green, linewidth=2)
alertcondition(ta.crossover(close, ema), "Price crosses above EMA", "Price crossed above the EMA")
alertcondition(ta.crossunder(close, ema), "Price crosses below EMA", "Price crossed below the EMA")
No comments yet.
Sign in to comment.