Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Exponential Moving Average

Classic moving-average smoothing classic ema

The Exponential Moving Average gives more weight to recent prices.

Usage

Use as the foundational smoothing module providing SMA, EMA, WMA, and SMMA implementations that power higher-level indicators across the library.

Background

The core smoothing algorithms — SMA, EMA, WMA — are the building blocks of nearly all technical indicators. EMA applies exponential decay weighting (alpha = 2/(n+1)), SMA applies uniform weighting over N bars, and WMA applies linearly increasing weights emphasizing more recent bars.

Parameters

  • period (default: 14): Smoothing period

Formula

[ EMA = P_t \times \alpha + EMA_{t-1} \times (1 - \alpha) ]

Source