Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 1/1/2005 Posts: 2,645
|
A trivial but revealing property of Simple Moving Averages (SMA) will be given. For simplicity and in order to use the notation of TC2005, we will use SMA's of C, but the results are applicable to SMA's of any data sequence.
The P and Q are any positive integers.
Definition: An SMA of C of period P is defined to be:
AVGCP = (C0+C1+C2+...+C(P-1))/P
For example:
AVGC3 = (C0+C1+C2)/3
It is immediate that:
AVGCP.Q = (C(Q+0)+C(Q+1)+...+C(Q+P-1))/P
For example:
AVGC3.2 = (C2+C3+C4)/3
Theorem: For P and Q:
P*(AVGCP.0-AVGCP.Q) = Q*(AVGCQ.0-AVGCQ.P)
Notice that each side is obtained from the other by interchanging the P and Q. The proof is obtained by applying the definition to the left-side when P > Q.
We will demonstrate when P = 3 and Q = 2:
3*(AVGC3.0-AVGC3.2) = 3*((C0+C1+C2)/3-(C2+C3+C4)/3) = ((C0+C1)-(C3+C4)) = 2*((C0+C1)/2-(C3+C4)/2) = 2*(AVGC2.0-AVGC2.3)
Notice that if P > Q in the Theorem, there are overlapping terms on the left-side which are removed on the right-side. For P > Q, the left-side is deceptive in that it involves 2*P entries of values of C, some duplicated, but the right-side shows only 2*Q entries of values of C, none duplicated, are required.
As an application, suppose we wish a PCF for an ROC5 of an SMA20 of C increasing today. An immediate choice is:
(AVGC20.0-AVGC20.5)>(AVGC20.1-AVGC20.6)
But multiple applications of the Theorem show that this is equivalent to:
(C0-C5)>(C20-C25)
The first PCF may lead one to believe that 80 entries of C values are necessary. The second reveals that only 4 entries of C values are necessary. The second PCF reveals exactly what causes the ROC to increase.
Consider the result of the Theorem when Q = 1:
P*(AVGCP.0-AVGCP.1) = (C0-CP)
This results in a difference equation for AVGCP:
AVGCP = AVGCP.1+(C0-CP)/P
The change in AVGCP depends just as strongly on the distant past, CP, as it does on the present, C0. An adjustment in the value of CP can cause AVGCP to change by any value you please regardless of the value of C0.
This reveals much about the behavior of an SMA. For example, suppose you observe, as a Custom Indicator, an SMAP, P > 20, of a sequence of data X on Daily with Zoom = 9. The P > 20 was chosen because Zoom = 9 includes only 20 bars, not a full period of the SMA. Suppose you know NOTHING about the data sequence X. What does the SMA curve alone tell you about the period P and about the data sequence X you would observe in the window if were shown? The answer is: "Absolutely nothing."
Consider P = 21 and P = 500. Can you tell which one is which? No. Using the above results, we can change X OUTSIDE the Zoom = 9 Time Frame only and cause each curve to duplicate the original of the other. Thus, you can conclude nothing about the value of the period from the observation of the SMA alone.
For any P > 20, we can duplicate any predetermined curve in the Zoom = 9 Time Frame by adjusting the values of the data sequence X OUTSIDE the Time Frame only. Thus, we can conclude nothing about the values of the data sequence within the Time Frame from the observation of the SMA alone.
The above conclusions do not necessarily apply when something is known about the input data sequence X. For example, suppose X is a sequence of +1's and -1's. An increase in the SMA inplies the current X value is +1 and a decrease in the SMA implies the current X value is -1.
One would do well to keep these properties in mind when using SMA's.
Thanks, Jim Murphy
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
Addendum:
It seems appropriate to outline a simple procedure for changing values of C in the distant past in order to change the values of
AVGCP.k, k = 0,1,...,P-2,
to any predetermined values without disturbing the values of
Ck, k = 0,1,...,P-2.
1) Since,
AVGCP.0 = (C0+C1+...+C(P-1))/P
adjust C(P-1) so that AVGCP.0 becomes its predetermined value. Designate the adjusted value of C(P-1) by C'(P-1).
2) Since, AVGCP.1 is now
AVGCP.1 = (C1+C2+...+C'(P-1)+CP)/P
adjust CP so that the AVGCP.1 becomes its predetermined value. Designate the adjusted value of CP by C'P.
...
P-1) We can proceed in this manor until we have
AVGCP.(P-2) = (C(P-2)+C'(P-1)+...+C'(2*P-3))/P
at its predetermined value.
The objective has been accomplished.
Thanks, Jim Murphy
|
|
Registered User Joined: 1/1/2005 Posts: 2,645
|
Addendum 2:
A more fundamental result than the previous theorem is:
Theorem A: If P = Q+R, then
P*AVGCP = Q*AVGCQ + R*AVGCR.Q
The proof follows almost immediately from the definition.
P*AVGCP = (C0+C1+...+C(Q-1)+CQ+...+C(P-1)) = (C0+...+C(Q-1))+(CQ+...+C(P-1)) = Q*AVGCQ+R*AVGCR.Q
For example,
5*AVGC5 = 3*AVGC3+2*AVGC2.3 = 2*AVGC2+3*AVGC3.2
Theorem A can be used to prove Theorem and should precede it.
We are often interested in inequalities of SMA's as in crossings. The following is applicable in these cases.
Theorem B: If P > Q and R = P-Q, then
AVGCQ > AVGCP
if and only if
AVGCQ > AVGCR.Q
We use Theorem A in the proof.
AVGCQ > AVGCP
if and only if
P*AVGCQ > P*AVGCP
By Theorem A, this is equivalent to
P*AVGCQ > Q*AVGCQ+R*AVGCR.Q
Thus, we obtain
(P-Q)*AVGCQ > R*AVGCR.Q
and, consequently,
AVGCQ > AVGCR.Q
as required.
As an application, consider
AVGC5 > AVGC12
By Theorem B, this can be replaced by
AVGC5 > AVGC7.5
The results Theorem A and Theorem are useful for rewriting PCF's involving overlapping SMA's as equivalent PCF's involving only nonoverlapping SMA's. As we have seen, it is frequently easier to interpret some PCF's when only nonoverlapping SMA's are involved. Theorem B is a widely applicable result of Theorem A.
We have shown what should be a rather disturbing result to some. If NOTHING is known about a data sequence, the observation of an SMA of the data over an interval of length less than the period reveals absolutely nothing about the data over that same interval.
Thanks, Jim Murphy
|
|
Guest-1 |