Exponential Moving Average (EMA)
Returns the Exponential Moving Average, which gives more weight to recent prices compared to older prices. EMA reacts more quickly to price changes than SMA.
EMA vs SMA
| Feature | EMA | SMA |
|---|---|---|
| Weighting | More weight to recent prices | Equal weight to all prices |
| Responsiveness | Faster response to changes | Slower, smoother |
| Lag | Less lag | More lag |
| Use case | Short-term trading | Long-term trends |
Common EMA Periods
| Period | Usage |
|---|---|
| 9-day | Very short-term |
| 12-day | MACD component |
| 20-day | Short-term trend |
| 26-day | MACD component |
| 50-day | Medium-term trend |
Parameters
| Parameter | Description | Default |
|---|---|---|
| Symbol | Stock ticker symbol | Required |
| Days | Number of periods for average | 30 |
| StartDate | Calculate EMA as of this date | Today |
Examples
=ExponentialMovingAverage("AAPL")=ExponentialMovingAverage("AAPL", "12")=ExponentialMovingAverage("MSFT", "26")=ExponentialMovingAverage("SPY", "9")=ExponentialMovingAverage("AAPL", "20", DATE(2024,1,15))=ExponentialMovingAverage(A1, B1)When to Use
- Short-term trading strategies requiring quick signals
- MACD calculations (12-day and 26-day EMAs)
- Identifying recent trend changes
- Trading systems that need responsive indicators
- Crossover strategies with faster signals
When NOT to Use
| Scenario | Use Instead |
|---|---|
| Need smoother trend line | SimpleMovingAverage() |
| Long-term trend analysis | SimpleMovingAverage() with 200 days |
| Need momentum oscillator | RelativeStrengthIndex() |
| Need volatility measure | StandardDeviationOnClosePrice() |
Common Issues & FAQ
Q: Why is EMA returning "NA"? A: Check that:
- The symbol is valid and actively traded
- There is sufficient historical data
- The stock has been trading for at least the number of days requested
Q: What period should I use? A: Common periods:
- 9-12 days for very short-term trading
- 20-26 days for short-term analysis
- 50 days for medium-term
Q: How is EMA calculated? A: EMA = (Close - Previous EMA) * Multiplier + Previous EMA Where Multiplier = 2 / (Days + 1)
