The Moving Average Technical Indicator shows the mean instrument price value for a certain period of time.
Calculation
Simple Moving Average (SMA)
Simple, in other words, arithmetical moving average is calculated by summing up the prices of instrument closure over a certain number of single periods (for instance, 12 hours). This value is then divided by the number of such periods.
SMA = SUM(CLOSE, N)/N
Where:
N — is the number of calculation periods
Exponential Moving Average (EMA)
Exponentially smoothed moving average is calculated by adding the moving average of a certain share of the current closing price to the previous value. With exponentially smoothed moving averages, the latest prices are of more value. P-percent exponential moving average will look like:
EMA = (CLOSE(i)*P)+(EMA(i-1)*(100-P))
Where:
CLOSE(i) — the price of the current period closure
EMA(i-1) — Exponentially Moving Average of the previous period closure
P — the percentage of using the price value
Smoothed Moving Average (SMMA)
The first value of this smoothed moving average is calculated as the simple moving average (SMA):
SUM1 = SUM(CLOSE, N)
SMMA1 = SUM1/N
The second and succeeding moving averages are calculated according to this formula:
SMMA(i) = (SUM1-SMMA1+CLOSE(i))/N
Where:
SUM1 — is the total sum of closing prices for N periods
SMMA1 — is the smoothed moving average of the first bar
SMMA(i) — is the smoothed moving average of the current bar (except for the first one)
CLOSE(i) — is the current closing price
N — is the smoothing period
Linear Weighted Moving Average (LWMA)
In the case of weighted moving average, the latest data is of more value than more early data. Weighted moving average is calculated by multiplying each one of the closing prices within the considered series, by a certain weight coefficient.
LWMA = SUM(Close(i)*i, N)/SUM(i, N)
Where:
SUM(i, N) — is the total sum of weight coefficients

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hi all,
anyone could please help me on that:
i am looking for the source code of the function iMA. thank you so much!
,,,