fintech-algorithms
Using a coding agent? Give it the skill: npx skills add IslamBaraka90/Fintech-Algorithms-Library What it does →

Trend Smoothing

9 algorithms in Technical Indicators · 9 with asserted arithmetic.

In this family#

  1. Simple Moving Average (SMA) verified

    Arithmetic mean of the last window observations, emitted at every position where a complete window is available.

    calculateSma(values, window)
  2. Exponential Moving Average (EMA) verified

    Exponentially weighted mean seeded with the simple mean of the first span observations, so the series is reproducible rather than dependent on where the data starts.

    calculateEma(values, span)
  3. Weighted Moving Average (WMA) verified

    Linearly weighted mean over window observations: the most recent observation carries weight window, the oldest weight 1.

    calculateWma(values, window)
  4. Wilder RMA verified

    Wilder's smoothing — an exponential mean with decay 1 / period rather than 2 / (period + 1). This is the smoother RSI, ATR and ADX are defined against, and substituting a standard EMA changes their published values.

    calculateRma(values, period)
  5. Double Exponential Moving Average (DEMA) verified

    Double exponential moving average: 2 × EMA − EMA(EMA). Subtracting the second smoothing pass cancels most of the lag a single EMA introduces, at the cost of overshooting sharp reversals.

    calculateDemaComponents(values, span)
  6. Triple Exponential Moving Average (TEMA) verified

    Triple exponential moving average: 3 × EMA − 3 × EMA(EMA) + EMA(EMA(EMA)). More lag cancellation than DEMA, and correspondingly more overshoot.

    calculateTemaComponents(values, span)
  7. Hull MA verified

    Hull moving average: a weighted combination of two WMAs de-lagged against each other, then re-smoothed over sqrt(window). Far more responsive than an SMA of the same length, at the cost of overshoot.

    calculateHullMa(values, window)
  8. Kaufman Adaptive Moving Average (KAMA) verified

    Kaufman adaptive moving average. The smoothing constant moves between a fast and a slow bound according to an efficiency ratio — directional travel divided by total travel — so the average tightens in a trend and loosens in noise.

    calculateKama(values, efficiencyPeriod, fastPeriod, slowPeriod)
  9. MESA Adaptive Moving Average (MAMA) verified

    MESA adaptive moving average. A Hilbert transform estimates the dominant cycle period of the series, and the smoothing rate follows the rate of phase change — so the average adapts to cycle length rather than to a fixed window.

    mama(values, fastLimit, slowLimit)

What they share#

Every topic here is a series-transform, so once you have called one the rest follow the same shape. Import paths differ only in the final segment:

ts
import { calculateSma } from "fintech-algorithms/technical-indicators/trend-smoothing/sma";
import { calculateEma } from "fintech-algorithms/technical-indicators/trend-smoothing/ema";

Read them in the order above — the sequence is pedagogical, not alphabetical.

Where this sits#

Technical Indicators collects 37 algorithms across 5 families. For the concept behind this family rather than the call signatures, see the concept guides.