{
    "name": "Moving Average Calculator",
    "url": "https://calculators.geekmidst.com/calculators/moving-average-calculator",
    "markdown": "https://calculators.geekmidst.com/calculators/moving-average-calculator.md",
    "category": "Statistics & probability",
    "description": "Calculate simple (SMA), exponential (EMA) and linearly weighted (WMA) moving averages for any window, with the full series in a table and chart.",
    "summary": "A moving average smooths a series by averaging the most recent k values. The simple average weights them equally; the exponential and weighted versions lean towards the latest values.",
    "also_called": [
        "Rolling average calculator",
        "SMA calculator",
        "EMA calculator"
    ],
    "applies_to": "Worldwide",
    "last_updated": "2026-10-29",
    "computation": "Results are computed in the visitor’s browser on the HTML page. This API describes the calculator; it does not compute results.",
    "inputs": [
        {
            "name": "values",
            "label": "Series (oldest first)",
            "type": "textarea",
            "default": "2, 4, 6, 8, 12"
        },
        {
            "name": "window",
            "label": "Window (k)",
            "type": "number",
            "default": "3",
            "unit": "periods"
        }
    ],
    "outputs": [
        {
            "key": "sma",
            "label": "Latest simple moving average",
            "format": "number"
        },
        {
            "key": "ema",
            "label": "Latest exponential moving average",
            "format": "number"
        },
        {
            "key": "wma",
            "label": "Latest weighted moving average",
            "format": "number"
        },
        {
            "key": "alpha",
            "label": "EMA smoothing factor α",
            "format": "number"
        },
        {
            "key": "points",
            "label": "Averages calculated",
            "format": "integer"
        }
    ],
    "formula": {
        "text": "SMA = (x₁ + … + x_k) ÷ k;  EMA_t = α·x_t + (1 − α)·EMA_{t−1}, α = 2 ÷ (k + 1), first EMA = first SMA;  WMA = Σ j·x_j ÷ (k(k + 1)/2), newest weight k",
        "variables": {
            "k": "window length",
            "x": "values in the window",
            "α": "EMA smoothing factor"
        }
    },
    "worked_example": {
        "inputs": {
            "values": "2, 4, 6, 8, 12",
            "window": "3"
        },
        "steps": [
            "Latest SMA = (6 + 8 + 12) ÷ 3 = 8.6667.",
            "α = 2 ÷ (3 + 1) = 0.5. EMA starts at the first SMA, 4; then 0.5 × 8 + 0.5 × 4 = 6; then 0.5 × 12 + 0.5 × 6 = 9.",
            "WMA = (1 × 6 + 2 × 8 + 3 × 12) ÷ 6 = 9.6667."
        ],
        "result": "With a 3-period window the latest SMA is 8.67, the EMA 9 and the WMA 9.67."
    },
    "interpretation": "Moving averages lag the data. The SMA lags most; the EMA and WMA react faster to the latest change. A longer window smooths more but lags more.",
    "assumptions": [
        "Values are equally spaced in time and listed oldest first.",
        "The EMA is seeded with the simple average of the first k values, the usual convention."
    ],
    "limitations": [
        "EMA values for the first few periods depend on the seeding method, so they can differ slightly from charting software that seeds differently."
    ],
    "rules": null,
    "faqs": [
        {
            "question": "Why does my EMA differ from my trading platform?",
            "answer": "Platforms differ in how they start the EMA (first value or first SMA) and how much history they load. After about 3k periods the difference becomes negligible."
        },
        {
            "question": "Should I use a centred moving average?",
            "answer": "For smoothing historical data, a centred average avoids lag. For forecasting or live signals, use a trailing average like this one, which only uses past values."
        }
    ],
    "sources": [],
    "related": [
        {
            "name": "Exponential Smoothing Calculator",
            "url": "https://calculators.geekmidst.com/calculators/exponential-smoothing-calculator"
        },
        {
            "name": "Time Series Growth Calculator",
            "url": "https://calculators.geekmidst.com/calculators/time-series-growth-calculator"
        },
        {
            "name": "Average Calculator",
            "url": "https://calculators.geekmidst.com/calculators/average-calculator"
        }
    ],
    "disclaimer": null,
    "publisher": "GM¹X CalcVerse"
}