MA: Moving Average
Also known as: MA, Simple Moving Average, Exponential Moving Average, Rolling Average
What is it?
A moving average is the average closing price over the last N bars, recalculated on every new bar, drawn as a line that smooths price into a single readable direction. The two versions you will meet differ only in what they weight. A simple moving average (SMA) treats all N closes equally: a 20-period SMA simply adds the last 20 closes and divides by 20.
| Simple MA (SMA) | Exponential MA (EMA) | |
|---|---|---|
| How it weights closes | All N closes count equally | Recent closes count more |
| Reaction to a turn | Confirms late | Turns earlier |
| Behaviour in chop | Stays smooth, ignores noise | Changes direction more often |
| Effect of a longer period | Smoother line, later signal | Smoother line, later signal |
| Typical use | Trend filter, higher timeframe | Entry trigger, trading timeframe |
An exponential moving average (EMA) weights recent closes more heavily, so it turns sooner after a change in direction and lags less - at the cost of reacting to moves that turn out to be noise. Every moving average is backward-looking by construction, and that is the whole trade-off. A longer period gives a smoother, more reliable line that confirms direction late; a shorter period gives an early line that changes its mind often.
Neither predicts anything - the line tells you what price has already been doing, which is why moving averages are used as context or as a mechanical trigger rather than as a forecast.
Why it matters: A moving average turns noisy price into one readable direction, which is why most rule-based entries and trend filters are built on top of it.
SMA(n) = sum of the last n closes / n
The period you choose decides how late every entry and exit fires, so it shifts a strategy's whole result far more than most traders expect.
Real-world example
On the S&P 500 daily chart, a 20-period EMA turned back up several sessions before the 50-period SMA did, giving an earlier entry on the same move and a wider stop distance to go with it.
How SignalBots handles it
Moving averages sit behind the trend filter on many SignalBots strategies: a signal can be suppressed when price is on the wrong side of its longer average, so you receive fewer counter-trend alerts. See /risk-warning.
Pro tip
Pick the period from the trade duration you actually want, not from a popular number - a 200-period average is irrelevant to a bot that holds positions for hours.
Common pitfalls
Testing dozens of periods and shipping the best one. That number is usually fitted to the sample, and it rarely survives on data the test never saw.
Frequently asked questions
What is the difference between an SMA and an EMA?
An SMA weights every close in the window equally, while an EMA gives recent closes more weight. The EMA therefore turns sooner after a change in direction, and also reacts more often to moves that go nowhere.
Which moving-average period should I use?
Match it to your holding period rather than to convention. Bots holding for hours commonly use 10-50 bars on their trading timeframe; swing systems holding for weeks lean on 50-200 daily.
Is a moving-average crossover a reliable entry signal?
On its own it is a lagging trigger that performs well in trending conditions and poorly in ranges. Most rule sets pair it with a regime or volatility filter so it only fires when direction is actually sustained.
Do moving averages repaint?
A standard moving average on closed bars does not repaint - its value is fixed once the bar closes. The current, unclosed bar's value does move, which is why rule-based systems act on the close and not intrabar.
Can a moving average predict where price is going?
No. It is an average of prices that have already printed, so it describes what has happened. Its usefulness is in filtering noise and defining a consistent rule, not in forecasting the next move.