BACK TO CLAUDE SKILLS
◈
calculate_ema
IndicatorsEMAIndicator
INSTALLATION
$python -c "exec(open('calculate_ema.py').read())"
#or paste directly into your Claude Code terminal
[ ABOUT ]
Computes the Exponential Moving Average using the standard multiplier `k = 2 / (period + 1)`. Initializes with the first data point as the seed value, then applies the recursive formula `EMA = price × k + prev_EMA × (1 − k)` for each subsequent bar. Returns the full EMA series as a list.
The EMA gives more weight to recent prices than a simple moving average, making it more responsive to short-term price changes. This function is the foundation for `calculate_macd`, `identify_trend_direction`, and the golden/death cross scanners — all of which call `calc_ema` internally with different period parameters.
[ USAGE EXAMPLE ]
[ FULL CODE ]
[ METADATA ]
CategoryIndicators
ComplexityBeginner
LanguagePython 3.10+
TagsEMA, Indicator
[ ASK CLAUDE ]
Ask AI about this skill before installing it.