Moving Averages
SMA, EMA, WMA, DEMA, TEMA, and more -- how each is calculated and when to use them.
What are Moving Averages?
A moving average smooths out price data by averaging the closing prices over a set number of candles. Instead of reacting to every tick up and down, it gives you a line that shows the general direction the price is heading.
The word "moving" means the average recalculates at every new candle, dropping the oldest candle and adding the newest one. As a result, the line moves along with the price -- always reflecting the most recent N candles.
Moving averages are the most widely used category of technical indicators. They appear as lines overlaid on the price chart and serve as the foundation for many trading strategies -- from simple trend filters ("only buy when price is above the 200-period SMA") to crossover signals ("buy when the fast MA crosses above the slow MA").
The Core Tradeoff: Responsiveness vs Smoothness
Every moving average involves a tradeoff. A shorter period (fewer candles) makes the line more responsive -- it tracks price closely and reacts quickly to changes. But it also makes the line noisier, giving more false signals. A longer period produces a smoother line that filters out noise, but it reacts more slowly when the trend genuinely changes.
The different types of moving averages below are essentially different ways of handling this tradeoff. Some (like EMA) try to be more responsive without getting much noisier. Others (like TRIMA) prioritize smoothness above all else. None of them eliminate the tradeoff -- they just position themselves differently along it.
The Common Ones
These are the moving averages most traders use. If you are starting out, focus on SMA and EMA -- they cover the vast majority of use cases.
SMA (Simple Moving Average)
The most straightforward moving average. It adds up the closing prices of the last N candles and divides by N. Every candle in the window gets the same weight.
SMA is easy to understand and widely followed -- the 50-period and 200-period SMAs are reference points that many traders watch. Its main weakness is lag: because all candles are weighted equally, it reacts slowly when the price changes direction.
EMA (Exponential Moving Average)
Like SMA, but it gives more weight to recent candles. This makes it react faster when the price moves, while still smoothing out noise. The weighting drops off exponentially -- the most recent candle has the strongest influence, and each older candle matters progressively less.
EMA is the default choice for traders who want a moving average that keeps up with price better than SMA. It is also used internally by other indicators like MACD.
WMA (Weighted Moving Average)
WMA assigns linearly increasing weights to more recent candles. The newest candle gets the highest weight, the second newest gets slightly less, and so on down to the oldest candle which gets a weight of 1. This sits between SMA (equal weights) and EMA (exponential weights) in terms of responsiveness.
DEMA & TEMA
Double and Triple Exponential Moving Averages reduce lag beyond what a standard EMA can achieve. DEMA applies a mathematical correction to a single EMA to remove some of the delay. TEMA takes this a step further with a triple correction.
The result is a line that tracks price more closely during trends -- but the extra responsiveness can also produce more whipsaws (false signals) in choppy markets.
Read the full DEMA & TEMA deep-dive >
The Specialized Ones
These moving averages serve more specific purposes. They are less commonly used than SMA and EMA, but each has a niche where it shines.
TRIMA (Triangular Moving Average)
TRIMA is an SMA of an SMA -- it smooths the data twice. This produces the smoothest line of any moving average in this category, but at the cost of more lag. The weighting pattern looks like a triangle: candles in the middle of the window get the most weight, while candles at the edges (oldest and newest) get the least.
Use TRIMA when you want a very clean trend line and can tolerate slower reactions to price changes.
KAMA (Kaufman Adaptive Moving Average)
KAMA adjusts its smoothing automatically based on how noisy the market is. When the price is trending cleanly, KAMA speeds up and follows closely. When the price is choppy and directionless, KAMA slows down and stays level, avoiding false signals.
This adaptive behavior makes KAMA useful when you want a single moving average that works reasonably well in both trending and ranging conditions without manually changing the period.
MAMA (MESA Adaptive Moving Average)
MAMA is an adaptive moving average that adjusts its speed based on the rate of price change. It produces two lines: MAMA (the faster one) and FAMA (Following Adaptive Moving Average, the slower one). Crossovers between MAMA and FAMA can be used as trading signals, similar to a dual-moving-average crossover but with both lines adapting automatically.
MAMA uses signal processing techniques (the Hilbert Transform) under the hood, making it more complex than other moving averages. Its two parameters -- fast limit and slow limit -- control how quickly it can adapt, with defaults of 0.5 and 0.05.
T3 (Tillson T3)
T3 applies multiple layers of EMA smoothing with a volume factor that controls how aggressively it smooths. At a volume factor of 0 it behaves like a regular EMA. At 1 it produces very smooth curves but with more lag. The default volume factor of 0.7 balances smoothness and responsiveness.
T3 can produce curves that are smoother than DEMA or TEMA while keeping lag under control, but it requires tuning the volume factor for each use case.
HT_TRENDLINE (Hilbert Transform Trendline)
This is not a traditional moving average -- it uses the Hilbert Transform (a signal processing technique) to extract the underlying trend from price data. It adapts automatically to the dominant cycle in the data, so it has no period parameter.
HT_TRENDLINE is the most exotic indicator in this category. It works best on data with clear cyclical patterns.
Reference Table
| Indicator | Parameters | Responsiveness | Best for |
|---|---|---|---|
| SMA | period (default 20) | Slow | Trend identification, support/resistance |
| EMA | period (default 20) | Moderate | General purpose, crossover signals |
| WMA | period (default 30) | Moderate | Middle ground between SMA and EMA |
| DEMA | period (default 30) | Fast | Reduced-lag trend following |
| TEMA | period (default 30) | Fastest | Minimal-lag trend following |
| TRIMA | period (default 30) | Slowest | Ultra-smooth trend lines |
| KAMA | period (default 30) | Adaptive | Mixed trending/ranging conditions |
| MAMA | fast/slow limits | Adaptive | Adaptive dual-line crossovers |
| T3 | period, vfactor (0.7) | Tunable | Smooth curves with controlled lag |
| HT_TRENDLINE | none | Adaptive | Cycle-based trend extraction |
How Moving Averages are Used in Backtesting
In Simula, moving averages appear as overlay lines on the price chart. They can be used in entry and exit conditions in several ways:
Crossovers: Buy when a fast moving average crosses above a slow one, sell when it crosses below. This is the foundation of trend following strategies.
Price vs MA: Buy when the price closes above a moving average, sell when it closes below. This uses the MA as a trend filter.
Slope/direction: Use the MA's direction as a filter -- only take long trades when the MA is pointing up, for example.
Common Mistakes
Using moving average signals in ranging markets
Moving averages are trend-following tools. In a market that moves sideways without a clear direction, MA crossovers produce repeated false signals -- the fast MA keeps crossing back and forth over the slow MA without any follow-through. If your backtest results show many small losing trades in a row, this is a common cause.
Assuming shorter periods are always better
A shorter period reacts faster, which sounds like an advantage. But faster reactions also mean more noise and more false signals. A 10-period EMA will whipsaw you in and out of trades far more than a 50-period EMA. The right period depends on how much noise you can tolerate.
Over-optimizing the period to a specific dataset
It is tempting to test every period from 5 to 200 and pick the one that produced the best backtest result. This is a form of curve fitting -- the "optimal" period for one historical stretch may perform poorly on the next. Out-of-sample testing and walk-forward analysis help guard against this.
Where to Go Next
SMA (Simple Moving Average) -- deep-dive into the most fundamental moving average.
EMA (Exponential Moving Average) -- deep-dive into the most popular alternative to SMA.
DEMA & TEMA -- deep-dive into reduced-lag moving averages.
Trend Following -- strategies built around moving average signals.
Combining Indicators -- how to pair moving averages with other indicators for confirmation.