# Exponentially weighted moving average

**URL:** <https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095>\
**Category:** Uncategorized\
**Created:** [7 November 2023 10:47 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095 "2023-11-07T10:47:36Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![R\_M](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r_m/32/27909_2.png) [@R\_M](https://forum.intervals.icu/u/R_M)\
**Post date:** [7 November 2023 10:47 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/1 "2023-11-07T10:47:36Z")

</div>

Hi there,

I understand this is a nerdy one, but…

Is there a way to get exponentially weighted moving average of intervals different from 42 and 7 days? Bith in fitness and activity charts?

Any workaruond in Java maybe?

Thanks!

Riccardo

---

<div class="post-metadata">

**Author:** ![MedTechCD](https://forum.intervals.icu/user_avatar/forum.intervals.icu/medtechcd/32/40383_2.png) [@MedTechCD](https://forum.intervals.icu/u/MedTechCD)\
**Post date:** [7 November 2023 12:06 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/2 "2023-11-07T12:06:36Z")

</div>

I’m not sure if this is what you need but you can set the days for fatigue and fitness

 ![image](https://forum.intervals.icu/uploads/default/original/3X/e/6/e680d62a1e2c21f549e61f667871cf67c1ba3d05.png)

 ![image](https://forum.intervals.icu/uploads/default/original/3X/c/5/c5a28fe35a2898579779cb7b8ea46ac80af72de8.png)

---

<div class="post-metadata">

**Author:** ![R\_M](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r_m/32/27909_2.png) [@R\_M](https://forum.intervals.icu/u/R_M)\
**Post date:** [7 November 2023 12:50 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/3 "2023-11-07T12:50:55Z")

</div>

Thank you for your reply… no, it’s not really what I need.

I’d like to have plots for exponentially weighted moving average o whatever data set (e.g. weight), where I can set the period as I like (other than 7 or 42).

Formula/explanation here:

[https://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm](https://www.itl.nist.gov/div898/handbook/pmc/section4/pmc431.htm)

Thanks!

---

<div class="post-metadata">

**Author:** ![Gerald](https://forum.intervals.icu/user_avatar/forum.intervals.icu/gerald/32/28423_2.png) [@Gerald](https://forum.intervals.icu/u/Gerald)\
**Post date:** [7 November 2023 13:03 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/4 "2023-11-07T13:03:00Z")

</div>

Do you mean like this?

 ![image](https://forum.intervals.icu/uploads/default/original/3X/a/4/a41eb258f7d9f5e73b03bfd679c0cef9a65e366a.png)

---

<div class="post-metadata">

**Author:** ![Inigo\_Tolosa](https://forum.intervals.icu/user_avatar/forum.intervals.icu/inigo_tolosa/32/26187_2.png) [@Inigo\_Tolosa](https://forum.intervals.icu/u/Inigo_Tolosa)\
**Post date:** [7 November 2023 13:53 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/5 "2023-11-07T13:53:06Z")

</div>

Not sure if you need exponential average or just simple moving average.  
It seems you want to evaluate average for last N days, so it is given by N points moving average.  
Exponential average doesn’t have a finit period of time associated, but a factor that reduces relevance of past values, but it takes into account full time series

---

<div class="post-metadata">

**Author:** ![R\_M](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r_m/32/27909_2.png) [@R\_M](https://forum.intervals.icu/u/R_M)\
**Post date:** [7 November 2023 15:03 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/6 "2023-11-07T15:03:38Z")

</div>

Exponentially weighted moving average is widely used in data analisys and is different from simple moving average as it assigns different “weights” to past data depending on their position back in time (in simple moving average, all data in the set have the same “weight” equals to 1, i.e. every data back in time have the same impact on the final result).

In th esimplest form of EWMA the “weight” or smoothing factor depends on how large is the interval you’re looking at, i.e. it is a function of it. Tipically, a data will have less and less influence on current value as it goes further back in time.

It’s the same principle of fitness and fatigue plots, but instead of having 42 and 7 days long intevals, you can set the interval as you like. One widely used interval is 20 (~0.9 smoothing factor), which has proved to have some sense in real life when you are predicting/controlling complex systems. It comes in handy, for example, for body weight tracking.

Thanks!

Riccardo

---

<div class="post-metadata">

**Author:** ![R\_M](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r_m/32/27909_2.png) [@R\_M](https://forum.intervals.icu/u/R_M)\
**Post date:** [7 November 2023 15:04 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/7 "2023-11-07T15:04:14Z")

</div>

Nope, see my explanation just above.

Thanks!

---

<div class="post-metadata">

**Author:** ![regulaattori](https://forum.intervals.icu/user_avatar/forum.intervals.icu/regulaattori/32/65298_2.png) [@regulaattori](https://forum.intervals.icu/u/regulaattori)\
**Post date:** [10 October 2025 13:53 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/8 "2025-10-10T13:53:01Z")

</div>

I’m also interested in using exponentially weighted moving avarages of a set number of days (not just 7 or 42) for different metrics, as described here by R\_M. Any solutions?

---

<div class="post-metadata">

**Author:** ![regulaattori](https://forum.intervals.icu/user_avatar/forum.intervals.icu/regulaattori/32/65298_2.png) [@regulaattori](https://forum.intervals.icu/u/regulaattori)\
**Post date:** [10 October 2025 14:13 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/9 "2025-10-10T14:13:11Z")

</div>

To add why, I got an idea to estimate skeletal fatigue caused by running prompted by a recent stress fracture. I’m under the impression that skeletal fatigue takes longer to recover from, around 3 weeks, so would use a 21 day exponential moving average on load data from running. (This is just some “bro science”, but think it could be helpful.)

But can also see it being useful in other data, such as weight mentioned by R\_M, resting HR or VO2max. A simple moving average is not statistically as interesting in many cases.

---

<div class="post-metadata">

**Author:** ![regulaattori](https://forum.intervals.icu/user_avatar/forum.intervals.icu/regulaattori/32/65298_2.png) [@regulaattori](https://forum.intervals.icu/u/regulaattori)\
**Post date:** [3 November 2025 18:43 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/10 "2025-11-03T18:43:03Z")

</div>

As far as I understand, this is impossible right now.

I think this post should be marked as a feature request!

I believe this another request would be filled with the same work by making some scripting possible.

> [@Mathematical equations within custom fitness charts](https://forum.intervals.icu/t/mathematical-equations-within-custom-fitness-charts/56626):
>
> Hi, I’ve been trying to search for this information for a while but have had no luck so far: Is it possible to add some simple mathematical formulas within the custom charts on the fitness page? For instance, it’s easy to create a custom chart that shows calories consumed, and it’s easy to create a custom chart that shows calories burned in workout, but is it possible to create a chart that shows “calories consumed” MINUS “calories burned”? Or even “calories consumed” MINUS “1500” MINUS “calor…

---

<div class="post-metadata">

**Author:** ![tennisninja](https://forum.intervals.icu/letter_avatar_proxy/v4/letter/t/e47774/32.png) [@tennisninja](https://forum.intervals.icu/u/tennisninja)\
**Post date:** [15 May 2026 01:16 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/11 "2026-05-15T01:16:22Z")

</div>

I too would like to use EWMA on my body weight chart. Is there a way to do this yet?

---

<div class="post-metadata">

**Author:** ![R\_M](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r_m/32/27909_2.png) [@R\_M](https://forum.intervals.icu/u/R_M)\
**Post date:** [15 May 2026 03:14 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/12 "2026-05-15T03:14:37Z")

</div>

Hi,

Since I’m not in coding, I use Fatigue Average instead of EMA7 and Fitness Average for EMA42.  
Not the same, but a good proxy for me.

---

<div class="post-metadata">

**Author:** ![R2Tom](https://forum.intervals.icu/user_avatar/forum.intervals.icu/r2tom/32/50144_2.png) [@R2Tom](https://forum.intervals.icu/u/R2Tom)\
**Post date:** [15 May 2026 04:59 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/13 "2026-05-15T04:59:02Z")

</div>

I didn’t tried it yet, but could be possible now:

> [@Easy custom formulas on fitness charts](https://forum.intervals.icu/t/easy-custom-formulas-on-fitness-charts/123646/1):
>
> The formula is evaluated once for each day in the date range. You can assign values to variables and these carry over from one day to the next (0 for the first day). You can create multi line expressions where the value of the expression is the value from the last line.
> 
> Here is the exponentially weighted moving average for fitness (CTL):
> 
> ```auto
> f = exp(-1 / 42)
> v = v * f + (fitness_load ?? 0) * (1 - f)
> 
> ```
> 
> Note the use of the `??` operator to convert null or undefined fitness\_load (no training on that day) into zero

---

<div class="post-metadata">

**Author:** ![RChung](https://forum.intervals.icu/letter_avatar_proxy/v4/letter/r/e19adc/32.png) [@RChung](https://forum.intervals.icu/u/RChung)\
**Post date:** [15 May 2026 15:08 UTC](https://forum.intervals.icu/t/exponentially-weighted-moving-average/53095/14 "2026-05-15T15:08:08Z")

</div>

Note that a “42 day” and “7 day” time constant actually means the decay rate is 1/42 = .0238 and 1/7 = .1428.

Decay rates and time constants are easily converted to half-lives: if the time constant is 42, the half-life is just 42 \* log(2) = 29 days, and if the time constant is 7 the half-life is 7 \* log(2) = 5 days. People often are more familiar with half-lives than EWMA time constants.
