A moving average is the mean of your most recent daily values within a fixed window, for example 7 or 14 days. Each day the window moves forward by one day: the new value comes in, the oldest one drops out.
For body weight it is the simplest way to build a trend weight. A single outlier gets divided by the number of days in the window and loses most of its effect.
Worked example
Example: Your last 14 daily readings add up to 1,176.0 kg. Divided by 14, that is a trend of 84.0 kg. The next day an outlier of 85.9 kg comes in while an old value of 84.5 kg drops out. The trend shifts by (85.9 - 84.5) ÷ 14 = 0.1 kg. A day that spikes 1.4 kg high moves the trend by a tenth of a kilogram. The numbers are heavily rounded.
7 or 14 days
A 7-day average reacts quickly and evens out a full weekly pattern. A 14-day average is calmer but trails a real change for longer. A longer window always means less jitter and a later response.
Its typical weakness is the edge of the window. An outlier keeps acting for as long as it sits in the window and then drops out all at once, which makes the line jump. Exponential smoothing, the default in Lean is law, avoids this because older values fade evenly. The moving average, on the other hand, is the easiest to check in your head. If a day has no reading, the calculation simply continues with the values available in the window; the trend just gets a little jumpier.