Glossary
Moving average
The mean of the last n prices, recomputed each period. It smooths price and lags it by about (n - 1) / 2 periods.
A simple moving average is (P_1 + ... + P_n) / n over the last n closes. Each new period drops the oldest price and adds the latest. A longer window is smoother and later.
It describes the recent past. It does not predict, and it produces many false crossings in sideways markets.
Example: the closes 105, 103, 107, 109 and 108 have a 5-period average of 106.4. On a price that rises by exactly 1 each day, a 20-period average trails the price by 9.5 periods.