Shape · Time series

Exponential Weighted Mean

Smooths a number column so recent rows count more than older ones. Gives a weighted mean, standard deviation or variance.

Also known as: EWMA, exponential smoothing

How it works

Group by computes one series per group. Order by sorts the rows first; with no sort the input order is used. Pick the Column to smooth and how to Decay by: Span, Alpha or Halflife, with one value; exactly one of the three must be set. Choose the Operation, Mean, Std or Var. The weights follow the recursive form (adjust off), so each value is alpha * current + (1 - alpha) * previous; rows where the source is NULL stay NULL in the output. The result is appended as column_ewm_span (or _alpha, _halflife) unless you set an Output column. This node runs on the desktop with the whole table in memory.

Inputs and outputs

Inputs

  • data — Table

Outputs

  • data — Table

Settings

The Attributes panel of Exponential Weighted Mean, as in the app: the controls work, but nothing runs — there is no data behind it.

The same settings, as the Assistant writes them
{
  column: string
  decayType: "span"|"alpha"|"halflife"
  span?: number
  alpha?: number
  halflife?: number
  operation: "mean"|"std"|"var"
  outputColumn?: string
  groupBy?: string[]
  orderBy?: [{ column, direction }]
}

Example

A 20-day exponential moving average of a closing price per ticker: column close, decay by Span with value 20, operation Mean, order by day, group by ticker, output ema_20.