Simple Moving Average (MVA, SMA)

From FxCodeBaseWiki
Jump to: navigation, search

Formula

The simple moving average is just an unweighted mean value (arithmetic average value) of the specified number of the most recent prices.

<math> \operatorname{MVA}(price, N)_i = \dfrac{{\sum_{j=i-N+1}^N} {price_{j}}}{N} </math>

Optimization

In case the previous value of the moving average is known, you don't need to calculate the whole sum. You can just remove the oldest value from the previous result and add a new value:

<math> \operatorname{MVA}(price, N)_{i} = \operatorname{MVA}(price, N)_{i-1} - \dfrac{price_{i-N}} {N} + \frac{price_{i}} {N} </math>

Usage

In Analysis

Smoothing Data

The first usage of the simple moving average indicator is smoothing "noisy" data. Smoothing removes spikes in the data and reduces the affect of coincidental fluctuations of the prices.

Mva1.png

Trend Detection

The second usage is detection of the market tendencies (trends). Depending on the parameter of the indicator, the slope of the moving average line can show the long (if N is big) or short (if N is small) term tendencies (trends). On the chart below the long-term moving average demonstrates that despite the fact that in the highlighted range the price goes up, the market is in down trend.

Mva2.png

In Trading

Classic Moving Average Strategy

The classic moving average strategy uses the trend detection feature of the moving average. The trader watches the short-term and long-term tendencies. When the short-term tendency changes and is strong enough to cross the long-term tendency, the trader enters the market following to the short-term tendency expecting that the long term will be changed soon.

The classic parameters recommended for stock market is 7, 14. For forex market it is usually recommended 5, 20. However, you shall always recognize all factors and choose such set of the parameters which properly reflects the current market situation.

Mva3.png

At the chart above the long-term MVA(25) is red and the short-term MVA(5) is green. The areas where the indicators intersect are highlighted. In the first area the short-term tendency is turned to grow and crosses the long-term tendency over. The trader buys (exits short, enters long). In the second area the short-term tendency is turned to fall and crosses the long-term tendency under. The trader sell (exits long, enters short). In third area the short term crosses the long-term over again. The trader switches to long (buys) again.


Moving Average As Trailing Stop

If the short-term parameter is 1 (just a price itself), the long term (usually 150 or more) moving average may be used as a trailing stop.

Mva4.png

Limitations

The major disadvantage of the moving average is its inertness. It smooths the data but shifts extremes into the future. If you look at the Classic Moving Average Strategy carefully, you'll see that the signal is delayed for 4-6 bars comparing the actual tendency change. This makes usage of the Moving Average on flat market very dangerous. It works well while market is trendy, but produces a lot of the false signals when the market moves neither up, nor down. In that case it recognizes the small fluctuation as tendency changes.

Mva5.png

See Also

Indicators

Exponential Moving Average (EMA), Linear Weighted Moving Average (LWMA)

Articles

This Article in Other Languages

Language: English  • español • français • русский • 中文 • 中文(繁體)‎