{"uid":"cap_59VdqpHTt7piKHE6vlovW","slug":"moving-average-calculator-sma-ema-581c8a9b","name":"Moving Average Calculator (SMA & EMA)","description":"Compute simple (SMA) and exponential (EMA) moving averages over a numeric series. Returns one value per input position - the first (window-1) SMA values are null since there isn't enough history. EMA uses the standard alpha = 2/(window+1) smoothing factor used in technical analysis.","url":"https://agent402.tools/api/moving-average","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"which":{"type":"string","description":"\"sma\", \"ema\", or \"both\" (default \"both\")"},"values":{"type":"array","description":"Numeric series (max 10000)"},"window":{"type":"number","description":"Window size, 2 to values.length"}}},"responseSchema":{"type":"json","example":{"ema":[10,10.5,11.25,12.125,13.0625,14.0312,15.0156,16.0078,17.0039,18.002],"sma":[null,null,11,12,13,14,15,16,17,18],"count":10,"window":3}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_nsHW67_eatpgMavzodMtI","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes simple (SMA) and/or exponential (EMA) moving averages over a numeric series, returning one value per input position with standard alpha smoothing for EMA.","exampleAgentPrompt":"Can you compute both the SMA and EMA moving averages with a window of 14 for this price series: [45.2, 46.1, 45.8, 47.3, 48.0, 47.5, 49.2, 50.1, 49.8, 51.0, 52.3, 51.7, 53.0, 54.2, 53.8, 55.1]?","exampleUseCases":null,"resultDescription":"Returns an object with one array per requested type (sma and/or ema), each containing one value per input element. The first (window-1) SMA values are null due to insufficient history. EMA uses alpha = 2/(window+1) and populates from the first valid window onward.","failureModes":["Window size smaller than 2 or larger than the array length returns a validation error","Non-numeric values in the series cause a parsing error","Array length exceeds 10000 items results in rejection","Invalid 'which' parameter value other than sma/ema/both returns an error","Empty values array returns an error or empty result"],"whenToPreferThis":"Use this endpoint when you need fast, pay-per-call moving average computation without setting up your own data pipeline or statistical library. Ideal for agents processing financial time series, sensor data, or any numeric sequence that needs smoothing on-the-fly. Prefer over manual computation when you need both SMA and EMA in a single call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T19:14:06.936Z","isFirstParty":false}