[{"data":1,"prerenderedAt":888},["ShallowReactive",2],{"content-query-FSVnrwE4ha":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"heading":10,"prompt":11,"tags":15,"files":17,"nav":6,"presets":18,"gallery":35,"body":37,"_type":881,"_id":882,"_source":883,"_file":884,"_stem":885,"_extension":886,"sitemap":887},"/tools/moving-average","tools",false,"","Moving Average Calculator for Excel & CSV","Calculate moving averages online from Excel or CSV data. Smooth noisy series and compare short-term versus long-term trends with AI.","Moving Average Calculator",{"prefix":12,"label":13,"placeholder":14},"Calculate a moving average","Describe the moving average analysis you want to run","e.g. SMA(7) and EMA(14) on monthly sales, plot crossover signals, compare smoothing windows 5 10 20",[16],"statistics",true,[19,25,30],{"label":20,"prompt":21,"dataset_url":22,"dataset_title":23,"dataset_citation":24},"Temperature trend smoothing","compute 5-year and 20-year simple moving averages of global temperature anomaly; overlay both on raw data; annotate the point where the 5-year MA consistently stays above the 20-year MA (sustained warming signal); compute year-over-year change in the 20-year SMA","https://ourworldindata.org/grapher/temperature-anomaly.csv","Global average temperature anomaly","Our World in Data",{"label":26,"prompt":27,"dataset_url":28,"dataset_title":29,"dataset_citation":24},"CO₂ 12-month moving average","12-month simple moving average of monthly CO2 concentration to remove seasonal cycle; also compute EMA with span=12; overlay both on raw data; report the smoothed growth rate (slope of SMA) in the most recent 10 years vs the previous 10 years","https://ourworldindata.org/grapher/co2-concentration-long-term.csv","CO₂ concentration in the atmosphere",{"label":31,"prompt":32,"dataset_url":33,"dataset_title":34,"dataset_citation":24},"Energy use trend MA","SMA(3) and SMA(10) moving averages of per-capita energy use; plot with raw data; overlay deviation oscillator (raw − SMA(10)); identify years where energy use was more than 5% above or below the 10-year moving average","https://ourworldindata.org/grapher/per-capita-energy-use.csv","Per capita energy use",[36],"/img/tools/moving-average.png",{"type":38,"children":39,"toc":870},"root",[40,49,98,145,164,170,242,248,361,366,372,522,528,652,658,720,726,763,769,798,815,844],{"type":41,"tag":42,"props":43,"children":45},"element","h2",{"id":44},"what-is-a-moving-average",[46],{"type":47,"value":48},"text","What Is a Moving Average?",{"type":41,"tag":50,"props":51,"children":52},"p",{},[53,55,61,63,68,70,75,77,82,84,89,91,96],{"type":47,"value":54},"A ",{"type":41,"tag":56,"props":57,"children":58},"strong",{},[59],{"type":47,"value":60},"moving average",{"type":47,"value":62}," smooths a time series by replacing each observation with the average of the surrounding window of w observations, reducing short-term noise and making the underlying trend more visible. The most common type is the ",{"type":41,"tag":56,"props":64,"children":65},{},[66],{"type":47,"value":67},"simple moving average (SMA)",{"type":47,"value":69},": the mean of the w most recent observations, all weighted equally. The ",{"type":41,"tag":56,"props":71,"children":72},{},[73],{"type":47,"value":74},"exponential moving average (EMA)",{"type":47,"value":76}," applies geometrically decreasing weights to older observations, giving more influence to recent values — it reacts faster to new trends than the SMA of the same nominal window. The ",{"type":41,"tag":56,"props":78,"children":79},{},[80],{"type":47,"value":81},"weighted moving average (WMA)",{"type":47,"value":83}," applies explicit custom weights (typically linearly decreasing) that the user specifies. Each type makes a different tradeoff between ",{"type":41,"tag":56,"props":85,"children":86},{},[87],{"type":47,"value":88},"lag",{"type":47,"value":90}," (how quickly the average tracks the true signal) and ",{"type":41,"tag":56,"props":92,"children":93},{},[94],{"type":47,"value":95},"smoothness",{"type":47,"value":97}," (how much short-term noise is suppressed).",{"type":41,"tag":50,"props":99,"children":100},{},[101,103,108,110,115,117,122,124,129,131,136,138,143],{"type":47,"value":102},"Moving averages are the foundation of a wide range of analytical workflows. In ",{"type":41,"tag":56,"props":104,"children":105},{},[106],{"type":47,"value":107},"trend analysis",{"type":47,"value":109},", a long-window SMA (e.g. 200-day) defines the primary direction of a time series — values consistently above the SMA indicate an uptrend; below indicates a downtrend. In ",{"type":41,"tag":56,"props":111,"children":112},{},[113],{"type":47,"value":114},"crossover analysis",{"type":47,"value":116},", two moving averages of different window lengths signal trend reversals: when a fast SMA crosses above a slow SMA (a ",{"type":41,"tag":56,"props":118,"children":119},{},[120],{"type":47,"value":121},"golden cross",{"type":47,"value":123},"), the short-term momentum is accelerating relative to the long-term trend; when the fast crosses below (a ",{"type":41,"tag":56,"props":125,"children":126},{},[127],{"type":47,"value":128},"death cross",{"type":47,"value":130},"), momentum is decelerating. In ",{"type":41,"tag":56,"props":132,"children":133},{},[134],{"type":47,"value":135},"deseasonalization",{"type":47,"value":137},", a 12-month SMA applied to monthly data exactly removes annual seasonality, leaving a cleaner trend signal. In ",{"type":41,"tag":56,"props":139,"children":140},{},[141],{"type":47,"value":142},"epidemiology",{"type":47,"value":144},", 7-day moving averages smooth out day-of-week reporting patterns in daily case counts.",{"type":41,"tag":50,"props":146,"children":147},{},[148,150,155,157,162],{"type":47,"value":149},"The ",{"type":41,"tag":56,"props":151,"children":152},{},[153],{"type":47,"value":154},"window size",{"type":47,"value":156}," is the critical parameter: a small window (e.g. SMA-5) tracks the data closely but retains much noise; a large window (e.g. SMA-50) is smooth but lags behind genuine trend changes by roughly w/2 periods. The ",{"type":41,"tag":56,"props":158,"children":159},{},[160],{"type":47,"value":161},"deviation oscillator",{"type":47,"value":163}," — the difference between the raw series and its moving average — separates the trend from the short-term fluctuations, showing how far above or below the average the current value is. Values consistently above the moving average indicate a bullish or above-trend environment; values persistently below indicate weakness.",{"type":41,"tag":42,"props":165,"children":167},{"id":166},"how-it-works",[168],{"type":47,"value":169},"How It Works",{"type":41,"tag":171,"props":172,"children":173},"ol",{},[174,199,215],{"type":41,"tag":175,"props":176,"children":177},"li",{},[178,183,185,190,192,197],{"type":41,"tag":56,"props":179,"children":180},{},[181],{"type":47,"value":182},"Upload your data",{"type":47,"value":184}," — provide a CSV or Excel file with a ",{"type":41,"tag":56,"props":186,"children":187},{},[188],{"type":47,"value":189},"date",{"type":47,"value":191}," column and a ",{"type":41,"tag":56,"props":193,"children":194},{},[195],{"type":47,"value":196},"value",{"type":47,"value":198}," column. Daily, weekly, monthly, or annual data all work. One row per time point.",{"type":41,"tag":175,"props":200,"children":201},{},[202,207,209],{"type":41,"tag":56,"props":203,"children":204},{},[205],{"type":47,"value":206},"Describe the analysis",{"type":47,"value":208}," — e.g. ",{"type":41,"tag":210,"props":211,"children":212},"em",{},[213],{"type":47,"value":214},"\"SMA(7) and EMA(14) overlaid on daily sales; golden cross / death cross annotations; deviation oscillator below\"",{"type":41,"tag":175,"props":216,"children":217},{},[218,223,225,232,234,240],{"type":41,"tag":56,"props":219,"children":220},{},[221],{"type":47,"value":222},"Get full results",{"type":47,"value":224}," — the AI writes Python code using ",{"type":41,"tag":226,"props":227,"children":229},"a",{"href":228},"https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.rolling.html",[230],{"type":47,"value":231},"pandas rolling/ewm",{"type":47,"value":233}," and ",{"type":41,"tag":226,"props":235,"children":237},{"href":236},"https://plotly.com/python/",[238],{"type":47,"value":239},"Plotly",{"type":47,"value":241}," to render the multi-MA overlay chart, crossover signal markers, and the deviation oscillator panel",{"type":41,"tag":42,"props":243,"children":245},{"id":244},"required-data-format",[246],{"type":47,"value":247},"Required Data Format",{"type":41,"tag":249,"props":250,"children":251},"table",{},[252,276],{"type":41,"tag":253,"props":254,"children":255},"thead",{},[256],{"type":41,"tag":257,"props":258,"children":259},"tr",{},[260,266,271],{"type":41,"tag":261,"props":262,"children":263},"th",{},[264],{"type":47,"value":265},"Column",{"type":41,"tag":261,"props":267,"children":268},{},[269],{"type":47,"value":270},"Description",{"type":41,"tag":261,"props":272,"children":273},{},[274],{"type":47,"value":275},"Example",{"type":41,"tag":277,"props":278,"children":279},"tbody",{},[280,322],{"type":41,"tag":257,"props":281,"children":282},{},[283,293,298],{"type":41,"tag":284,"props":285,"children":286},"td",{},[287],{"type":41,"tag":288,"props":289,"children":291},"code",{"className":290},[],[292],{"type":47,"value":189},{"type":41,"tag":284,"props":294,"children":295},{},[296],{"type":47,"value":297},"Date or time index",{"type":41,"tag":284,"props":299,"children":300},{},[301,307,309,315,316],{"type":41,"tag":288,"props":302,"children":304},{"className":303},[],[305],{"type":47,"value":306},"2020-01-01",{"type":47,"value":308},", ",{"type":41,"tag":288,"props":310,"children":312},{"className":311},[],[313],{"type":47,"value":314},"2020-01",{"type":47,"value":308},{"type":41,"tag":288,"props":317,"children":319},{"className":318},[],[320],{"type":47,"value":321},"Jan 2020",{"type":41,"tag":257,"props":323,"children":324},{},[325,333,338],{"type":41,"tag":284,"props":326,"children":327},{},[328],{"type":41,"tag":288,"props":329,"children":331},{"className":330},[],[332],{"type":47,"value":196},{"type":41,"tag":284,"props":334,"children":335},{},[336],{"type":47,"value":337},"Numeric time series",{"type":41,"tag":284,"props":339,"children":340},{},[341,347,348,354,355],{"type":41,"tag":288,"props":342,"children":344},{"className":343},[],[345],{"type":47,"value":346},"245.3",{"type":47,"value":308},{"type":41,"tag":288,"props":349,"children":351},{"className":350},[],[352],{"type":47,"value":353},"312.1",{"type":47,"value":308},{"type":41,"tag":288,"props":356,"children":358},{"className":357},[],[359],{"type":47,"value":360},"198.8",{"type":41,"tag":50,"props":362,"children":363},{},[364],{"type":47,"value":365},"Any column names work — describe them in your prompt. For financial OHLC data, specify which column to smooth (close price, volume, etc.).",{"type":41,"tag":42,"props":367,"children":369},{"id":368},"interpreting-the-results",[370],{"type":47,"value":371},"Interpreting the Results",{"type":41,"tag":249,"props":373,"children":374},{},[375,391],{"type":41,"tag":253,"props":376,"children":377},{},[378],{"type":41,"tag":257,"props":379,"children":380},{},[381,386],{"type":41,"tag":261,"props":382,"children":383},{},[384],{"type":47,"value":385},"Output",{"type":41,"tag":261,"props":387,"children":388},{},[389],{"type":47,"value":390},"What it means",{"type":41,"tag":277,"props":392,"children":393},{},[394,410,426,442,458,474,490,506],{"type":41,"tag":257,"props":395,"children":396},{},[397,405],{"type":41,"tag":284,"props":398,"children":399},{},[400],{"type":41,"tag":56,"props":401,"children":402},{},[403],{"type":47,"value":404},"SMA(w)",{"type":41,"tag":284,"props":406,"children":407},{},[408],{"type":47,"value":409},"Mean of the w most recent observations — equal weight to all; lags by w/2 periods",{"type":41,"tag":257,"props":411,"children":412},{},[413,421],{"type":41,"tag":284,"props":414,"children":415},{},[416],{"type":41,"tag":56,"props":417,"children":418},{},[419],{"type":47,"value":420},"EMA(span)",{"type":41,"tag":284,"props":422,"children":423},{},[424],{"type":47,"value":425},"Exponentially weighted mean — recent observations weighted more; lower lag than SMA",{"type":41,"tag":257,"props":427,"children":428},{},[429,437],{"type":41,"tag":284,"props":430,"children":431},{},[432],{"type":41,"tag":56,"props":433,"children":434},{},[435],{"type":47,"value":436},"WMA(w)",{"type":41,"tag":284,"props":438,"children":439},{},[440],{"type":47,"value":441},"Linearly weighted mean — most recent observation gets weight w, second most recent w−1, etc.",{"type":41,"tag":257,"props":443,"children":444},{},[445,453],{"type":41,"tag":284,"props":446,"children":447},{},[448],{"type":41,"tag":56,"props":449,"children":450},{},[451],{"type":47,"value":452},"Golden cross",{"type":41,"tag":284,"props":454,"children":455},{},[456],{"type":47,"value":457},"Fast MA crosses above slow MA — short-term momentum accelerating upward",{"type":41,"tag":257,"props":459,"children":460},{},[461,469],{"type":41,"tag":284,"props":462,"children":463},{},[464],{"type":41,"tag":56,"props":465,"children":466},{},[467],{"type":47,"value":468},"Death cross",{"type":41,"tag":284,"props":470,"children":471},{},[472],{"type":47,"value":473},"Fast MA crosses below slow MA — short-term momentum decelerating",{"type":41,"tag":257,"props":475,"children":476},{},[477,485],{"type":41,"tag":284,"props":478,"children":479},{},[480],{"type":41,"tag":56,"props":481,"children":482},{},[483],{"type":47,"value":484},"Deviation oscillator",{"type":41,"tag":284,"props":486,"children":487},{},[488],{"type":47,"value":489},"Raw − SMA — positive = above trend, negative = below trend",{"type":41,"tag":257,"props":491,"children":492},{},[493,501],{"type":41,"tag":284,"props":494,"children":495},{},[496],{"type":41,"tag":56,"props":497,"children":498},{},[499],{"type":47,"value":500},"Lag",{"type":41,"tag":284,"props":502,"children":503},{},[504],{"type":47,"value":505},"The moving average trails real changes by approximately (w−1)/2 periods",{"type":41,"tag":257,"props":507,"children":508},{},[509,517],{"type":41,"tag":284,"props":510,"children":511},{},[512],{"type":41,"tag":56,"props":513,"children":514},{},[515],{"type":47,"value":516},"Window size tradeoff",{"type":41,"tag":284,"props":518,"children":519},{},[520],{"type":47,"value":521},"Larger w = smoother but more lag; smaller w = reactive but noisy",{"type":41,"tag":42,"props":523,"children":525},{"id":524},"example-prompts",[526],{"type":47,"value":527},"Example Prompts",{"type":41,"tag":249,"props":529,"children":530},{},[531,547],{"type":41,"tag":253,"props":532,"children":533},{},[534],{"type":41,"tag":257,"props":535,"children":536},{},[537,542],{"type":41,"tag":261,"props":538,"children":539},{},[540],{"type":47,"value":541},"Scenario",{"type":41,"tag":261,"props":543,"children":544},{},[545],{"type":47,"value":546},"What to type",{"type":41,"tag":277,"props":548,"children":549},{},[550,567,584,601,618,635],{"type":41,"tag":257,"props":551,"children":552},{},[553,558],{"type":41,"tag":284,"props":554,"children":555},{},[556],{"type":47,"value":557},"Basic smoothing",{"type":41,"tag":284,"props":559,"children":560},{},[561],{"type":41,"tag":288,"props":562,"children":564},{"className":563},[],[565],{"type":47,"value":566},"SMA(7) and SMA(30) overlaid on daily data; which window best shows the underlying trend?",{"type":41,"tag":257,"props":568,"children":569},{},[570,575],{"type":41,"tag":284,"props":571,"children":572},{},[573],{"type":47,"value":574},"EMA vs SMA comparison",{"type":41,"tag":284,"props":576,"children":577},{},[578],{"type":41,"tag":288,"props":579,"children":581},{"className":580},[],[582],{"type":47,"value":583},"compare SMA(20) and EMA(20) on the same chart; annotate where EMA reacts faster to the trend reversal",{"type":41,"tag":257,"props":585,"children":586},{},[587,592],{"type":41,"tag":284,"props":588,"children":589},{},[590],{"type":47,"value":591},"Crossover signals",{"type":41,"tag":284,"props":593,"children":594},{},[595],{"type":41,"tag":288,"props":596,"children":598},{"className":597},[],[599],{"type":47,"value":600},"SMA(5) and SMA(20) crossover signals; annotate golden and death crosses; table of crossover dates",{"type":41,"tag":257,"props":602,"children":603},{},[604,609],{"type":41,"tag":284,"props":605,"children":606},{},[607],{"type":47,"value":608},"Deseasonalization",{"type":41,"tag":284,"props":610,"children":611},{},[612],{"type":41,"tag":288,"props":613,"children":615},{"className":614},[],[616],{"type":47,"value":617},"12-month SMA to remove annual seasonality from monthly data; plot deseasonalized series",{"type":41,"tag":257,"props":619,"children":620},{},[621,626],{"type":41,"tag":284,"props":622,"children":623},{},[624],{"type":47,"value":625},"Multiple windows",{"type":41,"tag":284,"props":627,"children":628},{},[629],{"type":41,"tag":288,"props":630,"children":632},{"className":631},[],[633],{"type":47,"value":634},"SMA(3), SMA(7), SMA(14), SMA(30) overlaid; which window loses the least detail while still smoothing?",{"type":41,"tag":257,"props":636,"children":637},{},[638,643],{"type":41,"tag":284,"props":639,"children":640},{},[641],{"type":47,"value":642},"Deviation analysis",{"type":41,"tag":284,"props":644,"children":645},{},[646],{"type":41,"tag":288,"props":647,"children":649},{"className":648},[],[650],{"type":47,"value":651},"SMA(20); plot deviation oscillator (raw − SMA); flag months where deviation > 2 standard deviations",{"type":41,"tag":42,"props":653,"children":655},{"id":654},"assumptions-to-check",[656],{"type":47,"value":657},"Assumptions to Check",{"type":41,"tag":659,"props":660,"children":661},"ul",{},[662,672,682,692,702],{"type":41,"tag":175,"props":663,"children":664},{},[665,670],{"type":41,"tag":56,"props":666,"children":667},{},[668],{"type":47,"value":669},"Regular spacing",{"type":47,"value":671}," — moving averages assume evenly spaced observations; irregular timestamps produce distorted windows; resample to a regular frequency first",{"type":41,"tag":175,"props":673,"children":674},{},[675,680],{"type":41,"tag":56,"props":676,"children":677},{},[678],{"type":47,"value":679},"Window must be shorter than the series",{"type":47,"value":681}," — the window w must be much smaller than the series length n; a window larger than n/3 produces meaningless averages over too few points",{"type":41,"tag":175,"props":683,"children":684},{},[685,690],{"type":41,"tag":56,"props":686,"children":687},{},[688],{"type":47,"value":689},"Centered vs trailing window",{"type":47,"value":691}," — trailing windows (all w points in the past) have a lag of (w−1)/2; centered windows have no lag but require future data and cannot be used in real-time",{"type":41,"tag":175,"props":693,"children":694},{},[695,700],{"type":41,"tag":56,"props":696,"children":697},{},[698],{"type":47,"value":699},"Trend vs seasonal periods",{"type":47,"value":701}," — a 12-month SMA applied to monthly data acts as a deseasonalizer; do not use this to estimate the underlying trend if your intent is to preserve seasonal information",{"type":41,"tag":175,"props":703,"children":704},{},[705,710,712,718],{"type":41,"tag":56,"props":706,"children":707},{},[708],{"type":47,"value":709},"EMA initialization",{"type":47,"value":711}," — the first EMA value depends on the initialization method (first-observation start vs warm-up period); ask the AI to use ",{"type":41,"tag":288,"props":713,"children":715},{"className":714},[],[716],{"type":47,"value":717},"adjust=False",{"type":47,"value":719}," for standard exponential smoothing behavior",{"type":41,"tag":42,"props":721,"children":723},{"id":722},"related-tools",[724],{"type":47,"value":725},"Related Tools",{"type":41,"tag":50,"props":727,"children":728},{},[729,731,737,739,745,747,753,755,761],{"type":47,"value":730},"Use the ",{"type":41,"tag":226,"props":732,"children":734},{"href":733},"/tools/moving-median-filter",[735],{"type":47,"value":736},"Moving Median Filter",{"type":47,"value":738}," when your data contains isolated spike outliers that would distort the mean — the median is more robust to extreme values. Use the ",{"type":41,"tag":226,"props":740,"children":742},{"href":741},"/tools/time-series-decomposition",[743],{"type":47,"value":744},"Time Series Decomposition",{"type":47,"value":746}," tool when you want to formally separate trend, seasonal, and residual components rather than just smoothing. Use the ",{"type":41,"tag":226,"props":748,"children":750},{"href":749},"/tools/trendline-calculator",[751],{"type":47,"value":752},"Trendline Calculator",{"type":47,"value":754}," to fit a parametric (linear or exponential) trend curve rather than a nonparametric moving average. Use the ",{"type":41,"tag":226,"props":756,"children":758},{"href":757},"/tools/seasonality-analysis",[759],{"type":47,"value":760},"Seasonality Analysis",{"type":47,"value":762}," tool to analyze the seasonal pattern that a 12-month moving average removes.",{"type":41,"tag":42,"props":764,"children":766},{"id":765},"frequently-asked-questions",[767],{"type":47,"value":768},"Frequently Asked Questions",{"type":41,"tag":50,"props":770,"children":771},{},[772,777,782,784,789,791,796],{"type":41,"tag":56,"props":773,"children":774},{},[775],{"type":47,"value":776},"What is the difference between SMA, EMA, and WMA?",{"type":41,"tag":56,"props":778,"children":779},{},[780],{"type":47,"value":781},"SMA",{"type":47,"value":783}," (simple moving average) gives equal weight to all w observations in the window — it is straightforward but lags true changes by (w−1)/2 periods. ",{"type":41,"tag":56,"props":785,"children":786},{},[787],{"type":47,"value":788},"EMA",{"type":47,"value":790}," (exponential moving average) uses geometrically decaying weights so recent observations matter more; for a given nominal window size, the EMA reacts roughly twice as fast as the SMA to new data. ",{"type":41,"tag":56,"props":792,"children":793},{},[794],{"type":47,"value":795},"WMA",{"type":47,"value":797}," (weighted moving average) applies explicit linear weights (most recent = w, previous = w−1, …, oldest = 1) — a middle ground between SMA and EMA. In practice, SMA is the standard for trend identification and deseasonalization; EMA is preferred when faster reaction to recent data is important; WMA is less common but useful when you want a specific weight decay profile.",{"type":41,"tag":50,"props":799,"children":800},{},[801,806,808,813],{"type":41,"tag":56,"props":802,"children":803},{},[804],{"type":47,"value":805},"How do I choose the right window size?",{"type":47,"value":807},"\nThe window size should match the ",{"type":41,"tag":56,"props":809,"children":810},{},[811],{"type":47,"value":812},"timescale of the noise you want to remove",{"type":47,"value":814},". For daily data with a weekly reporting cycle, a 7-day window removes day-of-week effects. For monthly data with an annual seasonal pattern, a 12-month window deseasonalizes. For identifying long-run trends, use a window equal to roughly one-third to one-half of the data span. A practical approach: plot the series with several window sizes (5, 10, 20, 50) and choose the smallest window that produces a visually smooth trend — the smallest window minimizes lag while achieving your smoothing goal.",{"type":41,"tag":50,"props":816,"children":817},{},[818,823,825,829,831,835,837,842],{"type":41,"tag":56,"props":819,"children":820},{},[821],{"type":47,"value":822},"What is a golden cross and should I trust it as a trading signal?",{"type":47,"value":824},"\nA ",{"type":41,"tag":56,"props":826,"children":827},{},[828],{"type":47,"value":121},{"type":47,"value":830}," occurs when a short-window moving average (e.g. SMA-50) crosses above a long-window moving average (e.g. SMA-200), signaling that recent momentum is stronger than the long-run average. A ",{"type":41,"tag":56,"props":832,"children":833},{},[834],{"type":47,"value":128},{"type":47,"value":836}," is the reverse. These are widely followed technical indicators in financial markets, but they are ",{"type":41,"tag":56,"props":838,"children":839},{},[840],{"type":47,"value":841},"lagging signals",{"type":47,"value":843}," — they confirm a trend that has already started rather than predicting it, and they generate many false signals in sideways markets. For scientific and business data, crossover signals are most useful as a simple visual marker for regime changes, not as predictive indicators. Always validate against domain knowledge.",{"type":41,"tag":50,"props":845,"children":846},{},[847,852,854,860,862,868],{"type":41,"tag":56,"props":848,"children":849},{},[850],{"type":47,"value":851},"Why does my moving average look flat or have a gap at the start?",{"type":47,"value":853},"\nFlat values at the start occur when the rolling window uses ",{"type":41,"tag":288,"props":855,"children":857},{"className":856},[],[858],{"type":47,"value":859},"min_periods=w",{"type":47,"value":861}," (requires a full window before computing) — the first w−1 positions are NaN. Set ",{"type":41,"tag":288,"props":863,"children":865},{"className":864},[],[866],{"type":47,"value":867},"min_periods=1",{"type":47,"value":869}," to start computing from the first observation using partial windows, or accept the NaN gap. The partial-window averages at the start have lower effective sample sizes and are less reliable — plot them in a lighter color or omit them from analysis. For EMA, no gap occurs because the calculation is recursive from the first point.",{"title":7,"searchDepth":871,"depth":871,"links":872},2,[873,874,875,876,877,878,879,880],{"id":44,"depth":871,"text":48},{"id":166,"depth":871,"text":169},{"id":244,"depth":871,"text":247},{"id":368,"depth":871,"text":371},{"id":524,"depth":871,"text":527},{"id":654,"depth":871,"text":657},{"id":722,"depth":871,"text":725},{"id":765,"depth":871,"text":768},"markdown","content:tools:056.moving-average.md","content","tools/056.moving-average.md","tools/056.moving-average","md",{"loc":4},1775502471854]