anyone could please help me on that:
i am looking for the source code of the function iMA. thank you so much!
Last edited by brspma; 04-06-2010 at 01:27 PM. Reason: realized my question should be different.. thanks
The Moving Average Technical Indicator shows the mean instrument price value for a certain period of time.
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
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))
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
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)
SUM(i, N) — is the total sum of weight coefficients.
|Thread Tools||Search this Thread|
Registered members gain free access to online FOREX currency trading tools, foreign exchange software, Metatrader MT4/MT5 expert advisors, MT4 indicators and EAs. Register now