Overlays · Indicator

Moving Average MA

A moving average smooths price into one line showing trend direction, and this indicator covers eight flavours from the simple SMA to the low-lag TEMA.

Open in chart

Overview

A moving average takes the price over the last N bars and reduces it to one number, then plots that number as a line across the chart. Because each new bar drops the oldest value and adds the newest, the line moves along with price while filtering out much of the bar-to-bar noise. What remains is a readable picture of the direction the market has been travelling, which is why the moving average is the most widely used indicator in technical analysis and the building block inside many others.

Every flavour trades the same two properties against each other: smoothness and lag. A longer or more heavily smoothed average produces a calmer line that ignores small wiggles, but it turns later, so it confirms a change in trend well after the change has begun. A shorter or more responsive average turns sooner but produces more false turns in a sideways market. No setting removes this trade-off, and the different flavours below are simply different points along that curve.

This indicator is a single Moving Average type with a flavour selector rather than eight separate entries in the browser, so you can add as many instances as you like and configure each independently. The Simple Moving Average is the arithmetic average of closing prices over N periods, smoothing short-term fluctuations to reveal the underlying trend direction. The Exponential Moving Average places greater weight on recent prices and reacts faster to price changes than a Simple Moving Average; both are commonly used for trend direction and dynamic support and resistance levels. The Weighted Moving Average applies linearly decreasing weights so the newest bar counts most, giving a middle ground between SMA and EMA. The Volume Weighted Moving Average weights each price by that bar's volume, so bars where a lot of trading took place pull the line harder than quiet bars, which suits traders who want the average to reflect where business was actually done. The Smoothed Moving Average, also called RMA, is the slow Wilder-style average used inside RSI and ATR; it responds far more gently than an EMA of the same length and is chosen when a very steady line matters more than a timely one. The Hull Moving Average combines weighted averages to cut lag sharply while staying smooth, at the cost of overshooting turns. The Double Exponential Moving Average and Triple Exponential Moving Average subtract the lag of an EMA of an EMA to hug price more closely still, with DEMA moderately faster than EMA and TEMA faster again; both are chosen for early trend detection and both whipsaw more in chop.

How it is calculated

Each flavour starts from the same source series, chosen with the Source setting, and differs only in how it weights the bars inside the window. The simple average weights every bar equally. The exponential family weights recent bars more heavily using a smoothing constant derived from the length. The weighted average uses a straight-line weight ramp, and the volume weighted average uses traded quantity as the weight.

The Hull average removes lag by taking a weighted average of half the length, doubling it, subtracting a weighted average of the full length, and then smoothing that difference over the square root of the length. DEMA and TEMA use the same subtract-the-lag idea, cancelling the delay introduced by applying an EMA to an EMA.

Every flavour needs a warm-up before it can print. An N-length simple, weighted or volume weighted average produces nothing until bar N; the exponential family seeds from an initial simple average, and DEMA and TEMA need several times the length before their values settle. Expect the left-hand edge of the chart to be blank, and expect a freshly loaded short history to under-report a long average.

SMA(n)  = (P[i] + P[i-1] + ... + P[i-n+1]) / n
EMA(n)  = P[i] * k + EMA[i-1] * (1 - k),   where k = 2 / (n + 1)
WMA(n)  = (n*P[i] + (n-1)*P[i-1] + ... + 1*P[i-n+1]) / (n + (n-1) + ... + 1)
VWMA(n) = sum(P[j] * V[j]) / sum(V[j]),  over the last n bars
SMMA(n) = (SMMA[i-1] * (n - 1) + P[i]) / n
HMA(n)  = WMA( 2 * WMA(n/2) - WMA(n),  sqrt(n) )
DEMA(n) = 2 * EMA(n) - EMA(EMA(n), n)
TEMA(n) = 3 * EMA(n) - 3 * EMA(EMA(n), n) + EMA(EMA(EMA(n), n), n)

Inputs

Type
Which flavour of average to plot: SMA (equal weight, smoothest), EMA (recent-weighted, faster), WMA (linear weights, between the two), VWMA (volume-weighted, reflects where trading occurred), SMMA/RMA (Wilder smoothing, slowest), HMA (low lag, some overshoot), DEMA and TEMA (lag-cancelling, fastest and noisiest). Default SMA.
Length
How many bars the average covers, default 21. Short lengths such as 9 or 21 track swing structure; 50 and 100 are common medium-term references; 200 is the long-term benchmark most widely quoted on daily charts.
Source
Which price from each bar feeds the average: close, open, high, low, hl2 (the bar's midpoint), hlc3 (the typical price), ohlc4 (the average of all four) or hlcc4 (a close-weighted average). Default close. The averaged sources produce a slightly smoother line that is less sensitive to a single extreme print.
Offset
Shifts the plotted line forward or backward by a number of bars, default 0. A positive offset displaces the line into the future, which is how displaced moving averages are drawn; a negative offset moves it into the past. The offset changes only where the line is drawn, never the values.

How to read it

The slope of the line is the first thing to read. A rising average means the average transaction price over the window is increasing, which is the working definition of an uptrend on that timeframe; a flat average means the market has gone sideways relative to the window. Where price sits relative to the line is the second: closing consistently above a rising average is the classic description of a healthy trend, and the reverse for a downtrend.

Averages are widely used as dynamic support and resistance. In a strong uptrend, pullbacks often stall near a rising average and resume, and the same average can act as a ceiling once the trend has turned. This is partly self-fulfilling: enough participants watch the 20, 50 and 200 lengths that orders cluster around them. It is not a physical barrier, and prices cut straight through these lines regularly.

Multiple averages of different lengths are often stacked to read the state of the trend at a glance. When a short average sits above a medium one which sits above a long one, and all three slope up, the trend is aligned across timeframes. When they knot together and cross repeatedly, the market is ranging and any signal drawn from crossovers will be unreliable.

Choose the flavour to match what you need from the line. If you want a stable reference level that most other participants can also see, an SMA at a conventional length is the sensible choice. If you want the earliest possible read on a change in direction and you accept more false turns, HMA, DEMA or TEMA will give it. VWMA is the option when you care that the average reflects the volume behind each price rather than treating a thin bar and a heavy one equally.

Signals to look for

Golden cross and death cross

A shorter average crossing above a longer one, most famously the 50 crossing the 200 on a daily chart, is called a golden cross and is read as a shift to a longer-term uptrend. The opposite crossing is called a death cross. Both are late by construction and both are prone to failing in a sideways market.

Pullback to the average

In an established trend, traders watch for price to retrace into a rising average and then resume in the trend direction. The average provides an objective reference for where the pullback is considered normal rather than a trend change.

Ribbon expansion and compression

Several averages of increasing length plotted together fan out as a trend accelerates and compress as it stalls. Compression with repeated crossings marks a market with no directional edge from the averages.

Loss of the long average

A decisive close below a long-term average such as the 200 after an extended uptrend, especially with the average itself rolling over, is widely tracked as a change in longer-term character. It is a description of what has already happened rather than a forecast.

Limitations

Frequently asked questions

What is Moving Average (MA)?

A moving average smooths price into one line showing trend direction, and this indicator covers eight flavours from the simple SMA to the low-lag TEMA.

How do you read MA on a chart?

The slope of the line is the first thing to read. A rising average means the average transaction price over the window is increasing, which is the working definition of an uptrend on that timeframe; a flat average means the market has gone sideways relative to the window. Where price sits relative to the line is the second: closing consistently above a rising average is the classic description of a healthy trend, and the reverse for a downtrend.

What signals do traders look for with MA?

Golden cross and death cross: A shorter average crossing above a longer one, most famously the 50 crossing the 200 on a daily chart, is called a golden cross and is read as a shift to a longer-term uptrend. The opposite crossing is called a death cross. Both are late by construction and both are prone to failing in a sideways market.

What are the limitations of MA?

Every moving average lags by construction, because it is built entirely from past prices. It cannot signal a turn until enough bars have already turned, so the entry it produces is always later than the extreme.

Related indicators

Bollinger BandsMoving Average Convergence DivergenceKeltner ChannelsVolume Weighted Average Price

Open in chart Start free trial All indicators