Media móvil
stats-moving-averageCalcula la media móvil simple (SMA) o exponencial (EMA) de una serie. Cuándo: un resultado numérico tiene que ser exacto o reproducible y no estimado. No para: pronosticar una serie numérica con suavizado exponencial simple, Holt (stats-forecast). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.
EN: Computes the simple (SMA) or exponential (EMA, alpha = 2/(window+1)) moving average of a series; SMA returns null until the window fills. When: a numeric result has to be exact or reproducible instead of estimated. Not for: forecasting a numeric series with simple exponential smoothing, Holt (stats-forecast). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | Type (optional; one of: sma, ema; default "sma"). | sma |
| values | Yes | Numbers (array of number; required; at least 1 items). | |
| window | Yes | Window size (integer; required; min 1; max 10000). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| values | No | any JSON value |