Moving average
4.5.1 << Trend technical indicators
(Moving Average, MA)
Moving Average (Moving Average, MA) is one of the most simple and widely used technical indicators. It shows the average price of a currency pair over time. Used to determine the trend. If the line is directed upward MA is that the trend is bullish, if the bottom is a bearish trend.
The moving average can be calculated in several ways, and depending on the method of its calculation are the following types of MA:
Simple Moving Average (SMA) - a simple moving average
Calculated as the ordinary arithmetic mean value of the price a specified number of bars:
SMA = SUM (Close (i), N) / N
where
SUM - sum;
CLOSE (i) - the closing price of the current period;
N - number of calculation periods.
Exponential Moving Average (EMA) - EMA
Exponentially smoothed moving average is calculated by adding the previous value of the moving average a certain percentage of the current closing price.
EMA = (CLOSE (i) * P) + (EMA (i - 1) * (100 - P))
Where:
CLOSE (i) - the closing price of the current period;
EMA (i - 1) - the value of the moving average of the previous period;
P - the percentage of the price value.
Smoothed Moving Average (SMMA) - smoothed moving average
The first value of the smoothed calculated as the simple moving average (SMA).
SUM1 = SUM (CLOSE (i), N)
SMMA1 = SUM1 / N
The second and subsequent moving averages are calculated using the following formula:
SMMA (i) = (SUM1 - SMMA (i - 1) + CLOSE (i)) / N
Where:
SUM - sum;
SUM1 - the sum of closing prices for N periods, calculated from the previous bar;
SMMA (i - 1) - smoothed moving average of the previous bar;
SMMA (i) - smoothed moving average of the current bar (except the first);
CLOSE (i) - current closing price;
N - smoothing period.
Linear Weighted Moving Average (LWMA) - linearly weighted moving average
When weighted moving average, more recent data have more weight in comparison with more recent data.
Weighted moving average is calculated by multiplying each of the closing prices in this range for a specific weighting factor.
LWMA = SUM (CLOSE (i) * i, N) / SUM (i, N)
Where:
SUM - sum;
CLOSE (i) - current closing price;
SUM (i, N) - sum of the weights;
N - smoothing period.
The simplest strategy is the use of AI is that the indicator value is compared with the dynamics of the price itself. When the price crosses the MA value of bottom-up, there is a signal to buy, when crossing from top to bottom, we have a sell signal.



