How it is calculated
An n-period simple moving average adds the selected price from the most recent n completed observations and divides by n. As a new observation enters, the oldest leaves. A longer window generally smooths more movement but responds more slowly to changes.
Five observations
For hypothetical closes of 100, 102, 101, 103 and 104, the five-period average is 102. If the next close is 110, the first value of 100 drops out. The new average is (102 + 101 + 103 + 104 + 110) ÷ 5 = 104.
Reading without overclaiming
The average summarises past prices. A cross above it does not establish that the next trade will be profitable. The timeframe and price input matter: a 20-day average and a 20-hour average summarise different observations. Test any trading rule separately from the indicator calculation.
Sources & method
Sources support the referenced concepts. Numerical examples are hypothetical unless stated otherwise. A link does not imply endorsement.