# Moving average

Moving average is the average of a stock’s prices over a rolling number of trading periods, used to smooth short-term fluctuations and describe its past price trend.

## What it means

A moving average smooths a stock’s price history by replacing each day’s price with an average calculated from a rolling window of prices. A 5-day moving average uses five trading days, not five calendar days. When a new trading day is added, the oldest day drops out.

Moving averages are **technical-analysis indicators**: they describe historical prices. A line rising on a chart indicates that the average of its included prices has risen, but it cannot establish what the next price will be. Common versions include the simple moving average (SMA), which gives every observation equal weight, and the exponential moving average (EMA), which gives more weight to recent observations.

The choice of price matters. An average based on closing prices can differ from one based on opening prices. Chart displays may also adjust historical prices for stock splits or dividends, changing the values shown. Comparisons are meaningful only when the price series and adjustment method are consistent.

## How it is calculated

For an SMA of closing prices, use:

`SMA_t(N) = (P_t + P_(t−1) + ... + P_(t−N+1)) / N`

- `SMA_t(N)` is the simple moving average at trading period `t`, in the same currency per share as the prices.
- `P_t` is the closing price at period `t`; `P_(t−1)` is the previous trading period’s closing price, and so on.
- `N` is the number of trading periods in the window, with no unit of currency.

You need at least `N` observations to calculate an `N`-period SMA. An EMA uses a different, recursively weighted formula, so an EMA and SMA with the same stated period will generally differ.

## Worked example

Suppose a hypothetical stock closes at US$20, US$22, US$24, US$26 and US$28 over five consecutive trading days.

1. Add the five closing prices: US$20 + US$22 + US$24 + US$26 + US$28 = US$120.
2. Divide by five: US$120 / 5 = **US$24 per share**. That is the day-five 5-day SMA.
3. Suppose the next close is US$30. Drop the oldest close, US$20, and add US$30: (US$22 + US$24 + US$26 + US$28 + US$30) / 5 = **US$26 per share**.

The average rose from US$24 to US$26 because the new observation was higher than the one it replaced. These hypothetical prices illustrate the arithmetic, not a likely market pattern.

## Why it matters before you trade

A moving average can help put a proposed trade in historical context. For example, it lets you see whether today’s price is above or below an average of recent closing prices. A short window responds to price changes faster than a long one, but it also follows short-lived fluctuations more closely. A long window is smoother and reacts more slowly.

Neither a crossover nor a price moving above an average establishes that an order will fill at the displayed price. A moving average is calculated from past observations; an actual trade encounters current quotes, available liquidity, bid-ask spread and potentially market impact. Those execution conditions matter particularly when an order is large relative to normal trading volume.

## How PreTrAIde uses it

PreTrAIde does not list a moving-average indicator among its stated quantitative measures. Its **pre-trade analysis** is not chart-pattern technical analysis: it assesses a proposed stock basket before an order is placed, including estimated spread, participation in daily volume, market impact, volatility and other risk and execution measures.

For each basket and stock line, PreTrAIde returns a GO, NO-GO or MODIFY verdict with reasoning. Those verdicts are decision support, not recommendations. A moving average may describe the chart a user is viewing, while a pre-trade check addresses different questions about the proposed basket and its execution conditions.

## Common mistakes

- **Treating an average as a forecast.** It summarizes earlier prices; it does not predict the next one.
- **Confusing trading days with calendar days.** A 20-day stock-price average normally refers to 20 trading sessions.
- **Comparing unlike calculations.** An SMA and EMA weight observations differently, even when both are called “20-day.”
- **Ignoring the price series.** Closing-price, opening-price and differently adjusted series can produce different averages.
- **Mistaking a chart signal for an execution check.** A moving average does not measure the spread, available volume or the cost of placing an order.

---
Source: https://pretraide.com/glossary/moving-average
