|
A moving average, in finance and especially in technical analysis, is one of a family of similar statistical techniques used to analyze time series data. Technical analysis (or chartism) is the study of price movement and trend in markets in order to forecast future prices. ...
In statistics and signal processing, a time series is a sequence of data points, measured typically at successive times, spaced apart at uniform time intervals. ...
A moving average series can be calculated for any time series, but is most often applied to stock prices, returns or trading volumes. Moving averages are used to smooth out short-term fluctuations, thus highlighting longer-term trends or cycles. The threshold between short-term and long-term depends on the application, and the parameters of the moving average will be set accordingly. In economics and business, the price is the assigned numerical monetary value of a good, service or asset. ...
In finance, the return on investment (ROI) or just return is a calculation used to determine whether a proposed investment is wise, and how well it will repay the investor. ...
Mathematically, each of these moving averages is an example of a convolution. These averages are also similar to the low-pass filters used in signal processing. For the computer science usage see convolution (computer science) . In mathematics and in particular, functional analysis, convolution is a mathematical operator which takes two functions f and g and produces a third function that in a sense represents the amount of overlap between f and a reversed and translated version...
A low-pass filter is a filter that passes low frequencies well, but attenuates (or reduces) frequencies higher than the cutoff frequency. ...
Signal processing is the processing, amplification and interpretation of signals and deals with the analysis and manipulation of signals. ...
Simple moving average
A simple moving average is the unweighted mean of the previous n data points. For example, a 10-day simple moving average of closing price is the mean of the previous 10 days' closing prices. If those prices are p1 to pn then the formula is In mathematics and statistics, the arithmetic mean of a set of numbers is the sum of all the members of the set divided by the number of items in the set (cardinality). ...
 When calculating successive values, a new value comes into the sum and an old value drops out, meaning a full summation each time is unnecessary,  In technical analysis there are various popular values for n, like 10 days, 40 days, or 200 days. The period selected depends on the kind of movement one is concentrating on, such as short, intermediate, or long term. In any case moving average levels are interpreted as support in a rising market, or resistance in a falling market. The support level is the lowest price a security trades at, over a period of time. ...
The resistance level is the highest price a security trades at over a period of time. ...
In all cases a moving average lags behind the latest price action, simply from the nature of its smoothing. An SMA can lag to an undesirable extent, and can be influenced too much by old prices dropping out of the average. This is addressed by giving extra weight to recent prices, as in the following two methods.
Weighted moving average A weighted average is any average that has multiplying factors to give different weights to different data points. But in technical analysis a weighted moving average (WMA) has the specific meaning of weights which decrease arithmetically. In an n-day WMA the latest day has weight n, the second latest n-1, etc, down to zero.  When calculating the WMA across successive values, it can be noted an amount p2 to pn + 1 drops out of the numerator each day. The WMA can thus be calculated starting with the above formula but then stepping successively with just additions and subtractions, not a full set of multiplications, - Totaltoday = Totalyesterday + p1 − pn + 1
- Numeratortoday = Numeratoryesterday + np1 − Totalyesterday
 The denominator, incidentally, is a triangle number, and equals Image File history File links Download high resolution version (1300x975, 7 KB) Summary This graph was created by me using the following bit of gnuplot set terminal png size 1300, 975 # set xlabel Days ago (0 today, 1 yesterday, etc) 0, -2 # # something evil happens with xtics axis, need dummy...
Image File history File links Download high resolution version (1300x975, 7 KB) Summary This graph was created by me using the following bit of gnuplot set terminal png size 1300, 975 # set xlabel Days ago (0 today, 1 yesterday, etc) 0, -2 # # something evil happens with xtics axis, need dummy...
A triangular number is a number that can be arranged in the shape of an equilateral triangle. ...
The graph at the right shows how the weights decrease, from highest weight for the most recent days, down to zero. It can be compared to the weights in the exponential moving average which follows.
Exponential moving average An exponential moving average (EMA), sometimes also called an exponentially weighted moving average (EWMA), applies weighting factors which decrease exponentially. The weighting for each day decreases by a factor, or percentage, on the one before it. The graph at right shows an example of the decrease. Image File history File links Download high resolution version (1300x975, 7 KB) This graph was created by me using the following bit of gnuplot set terminal png size 1300, 975 # set xlabel Days ago (0 today, 1 yesterday, etc) 0, -2 # # something evil happens with xtics axis, need dummy xlabel...
Image File history File links Download high resolution version (1300x975, 7 KB) This graph was created by me using the following bit of gnuplot set terminal png size 1300, 975 # set xlabel Days ago (0 today, 1 yesterday, etc) 0, -2 # # something evil happens with xtics axis, need dummy xlabel...
In mathematics, exponentiation is a process generalized from repeated (or iterated) multiplication, in much the same way that multiplication is a process generalized from repeated addition. ...
There are two ways to express this decrease. Firstly as a percentage whereby in say a 10% EMA, each weight is 10% less than the previous, ie. a multiplier factor f = 0.90. Or secondly, and more commonly, as an n days where the factor is, by convention, . For instance n = 19 is equivalent to the 10%. In either case the formula for calculating successive days is  The full formula for a given day is  In theory this is an infinite sum, but because f is less than 1, the terms become smaller and smaller, and can be ignored once small enough. The denominator approaches , and that value can be used instead of adding up the powers, provided one is using enough terms that the omitted portion is negligible. In mathematics, a series is a sum of a sequence of terms. ...
The n in an n-day EMA only specifies the f factor. It isn't a stopping point for the calculation in the way n is in an SMA or WMA. The first n days in an EMA do represent about 86% of the total weight in the calculation though. The power formula above gives a starting value for a particular day, after which the successive days formula shown first can be applied. It's interesting to note one can get the same result as the powering by applying the successive formula starting from far enough back, with an initial EMAyesterday of 0. In mathematics, a power series (in one variable) is an infinite series of the form where the coefficients an, the center c, and the argument x are usually real or complex numbers. ...
Either way, the question of how far back to go for an initial value depends, in the worst case, on the data. If there are huge p price values in old data then they'll have an effect on the total even if their weighting is very small. If one assumes prices don't vary too wildly then just the weighting can be considered, and work out how much weight is omitted by stopping after say k terms. This is , which is , ie. a fraction fk out of the total weight. Thus if the aim was to have 99.9% of the weight then many terms should be used. And what's more it can be shown approaches as n increases, so this simplifies to (roughly) for this example 99.9% weight.
Other weightings Other weighting systems are used occasionally – for example, a volume weighting will weight each time period in proportion to its trading volume. There are weighting systems designed using a combination of moving averages: The DEMA indicator (Double Exponential Moving Average) and TEMA indicator (Triple Exponential Moving Average) are unique composites of a single exponential moving average, a double exponential moving average, and in the latter case a triple exponential moving average that provides less lag than either of the three components individually. They were originally introduced January 1994 by Patrick Mulloy. The TRIX indicator uses a triple-EMA in its calculation. This ends up as just a certain set of weights on past data, and a set quite different to a plain EMA actually. Trix (or TRIX) is a technical analysis oscillator developed in the 1980s by Jack Hutson, editor of Technical Analysis of Stocks and Commodities magazine. ...
References |