You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
I often need to see MA(CLOSE,5), but the last bar is changing, so is the last value of MA(CLOSE,5) . I try to fix this by emulating a possible lowest (or highest) value....
I use SMMA, so I searched and find this :
----------------------
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.
.......
---------------------------------------------
Then I tried the following code:
...
Possible=(ExtMA5Buffer[0]*5-Close[0]+low[0])/5;
...
I put it on the chart, and the value just feels wrong, and that value vary too much (I guess it should be nearly fixed) --- as a matter of fact, I don't understand the above mentioned SMMA method, so my code is actually about SMA.
Could anybody please help me with this code?
Thanks.