Registered User Joined: 10/7/2004 Posts: 13
|
Is it possible to create a 'Smoothed Moving Average' in TC-2000? And can someone please tell me if there is a difference between a Simple Moving Average and a Smoothed Moving Average?
Thank you.
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
Here is what I found for a "smoothed" MA:
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.
You might be able to fake this in TeleChart but the calculation for the SMMA will end up using, to some very small degree, every day of data. I am not sure it is practical or even possible.
The idea is to give more weight to recent data by having the current close factor in more than previous closes. I would just use an exponential MA.
Check out this video:
Understanding Moving Averages - Part I, The Basics
- Craig Here to Help!
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
It is not clear to me what a Smoothed Moving Average is. We will designate its value today by SmoothedMA(C0,N), its value yesterday by SmoothedMA(C1,N), etc. In the literature I have found, it satisfies either:
1) SmoothedMA(C0,N) = (N*Smoothed(C1,N)-SmoothedMA(C1,N)+C0)/N
or,
2) SmoothedMA(C0,N) = (N*AVGCN.1-SmoothedMA(C1,N)+C0)/N
In either case, it is initialized with AVGCN.
It seems that the verbal description is always 2). In one case, the verbal description was 2) but a numerical example was 1).
Case 1) is Wilder Smoothing with period N, or, equivalently, an EMA with period P = 2*N-1. We make note that in Case 1) the filter is a single pole MA with the pole at (P-1)/(P+1) = (N-1)/N and input C0. Case 2) is also a single pole MA with the pole at -1/N and input AVGC(N+1).
You do not have to understand pole business. It is no more difficult to write a series expansion for one than the other. For case 2), just replace the period P in the series expansion for an EMA by (N-1)/(N+1). Also, replace the input C of the EMA series expansion by AVGC(N+1). In case 2), the larger N, the fewer terms needed in the series expansion.
By way of explaination of the SmoothedMA, consider the (unstable) equation for the SMA:
AVGCN.0 = (N*AVGCN.1-CN+C0)/N
The SmoothedMA is described as subtracting the previous smoothed average in this equation rather than CN. Thus, Equation 2).
Thanks, Jim Murphy
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
The following is a PCF for SmoothedMA(C,N) in Equation 2) when N = 3:
((3+1)/3) *(AVGC4.0-(1/3) *(AVGC4.1-(1/3) *(AVGC4.2-(1/3) *(AVGC4.3-(1/3) *(AVGC4.4-(1/3) *(AVGC4.5-(1/3) *(AVGC4.6-(1/3) *(AVGC4.7-(1/3) *(AVGC4.8-(1/3) *(AVGC4.9-(1/3) *((3/(3+1))*AVGC3.10 )))))))))))
The N = 3 was left intact so that the PCF could written for a different N. The exception is that AVGC4.k was written for AVGC(3+1).k. The initialization term is AVGC3.10 because 10 = 5*(N+1)/(N-1) when N = 3.
Thanks, Jim Murphy
|