Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 12/31/2004 Posts: 163
|
Hi Bruce or Craig,
TeleCharts only has a Simple and an Exponential Moving Averages.
How do I add a Weighted Moving Average?
Bill
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
It depends on the period.
2-Period WMA:
(2 * C + C1) / 3
3-Period WMA:
(3 * C + 2 * C1 + C2) / 6
4-Period WMA:
(4 * C + 3 * C1 + 2 * C2 + C3) / 10
Start by multiplying the current value by the period and subtract 1 from each of the coefficients as you go back. Then divide the result by the sum of the coefficients. If you create it using a Custom Indicator, make sure to select Plot using price scale.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 12/31/2004 Posts: 163
|
O.K. Bruce,
If I want a front weighted moving average, I just reverse the weighting from the current price being the highest weight to the earliest price being the highest weight, right?
Bill
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
No, he gave you the front weighted. Front weighted means the most recent price has more weight.
- Craig Here to Help!
|
|
Registered User Joined: 12/31/2004 Posts: 163
|
Oh!
Thanks Craig.
I decided to program a front weighted average and a reverse front weighted average (or is it Non-Front weighted or is it just weighted?), just to see the difference in the plot.
While doing so, I observed something interesting.
This calculation:
(15 * C14 + 14 * C13 + 13 * C12 + 12 * C11 + 11 * C 10 + 10 * C9 + 9 * C8 + 8 * C7 + 7 * C6 + 6 * C5 + 5 * C4 + 4 * C3 + 3 * C2 + 2 * C1 + C)
And this calculation:
(15 * C14 + 14 * C13 + 13 * C12 + 12 * C11 + 11 * C 10 + 10 * C9 + 9 * C8 + 8 * C7 + 7 * C6 + 6 * C5 + 5 * C4 + 4 * C3 + 3 * C2 + 2 * C1 + C) / 120
produce the same plot.
The difference: one is divided by 120 and the other isn't!
Is there an explanation?
I think I also noticed something else happening. I added a day's calculation then looked at the plot, then added another day, observed, etc, etc. The plot didn't seem to change much between 10 and 15 days. Is this just a spurious observation or a valid observation? The plot seemed to change more noticably when I was working on the days below 10.
Bill
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
They will present the same pattern and appear identical because they are both on different scales. Check the "plot using price scale" on both and you will see a HUGE difference.
- Craig Here to Help!
|
|
Registered User Joined: 12/31/2004 Posts: 163
|
Stranger than fiction!
|
|
Worden Trainer
Joined: 10/1/2004 Posts: 18,819
|
LOL
- Craig Here to Help!
|
|
Registered User Joined: 12/31/2004 Posts: 163
|
O.K. Craig/Bruce,
I settled on a 50 period front weighted average. See if I typed it correctly:
((50 * C) + (49 * C1) + (48 * C2) + (47 * C3) + (46 * C4) + (45 * C5) + (44 * C6) + (43 * C7) + (42 * C8) + (41 * C9) + (40 * C10) + (39 * C11) + (38 * C12) + (37 * C13) + (36 * C14) + (35 * C15) + (34 * C16) + (33 * C17) + (32 * C18) + (31 * C19) + (30 * C20) + (29 * C21) + (28 * C22) + (27 * C23) + (26 * C24) + (25 * C25) + (24 * C26) + (23 * C27) + (22 * C28) + (21 * C29) + (20 * C30) + (19 * C31) + (18 * C32) + (17 * C33) + (16 * C34) + (15 * C35) + (14 * C36) + (13 * C37) + (12 * C38) + (11 * C39) + (10 * C40) + (9 * C41) + (8 * C42) + (7 * C43) + (6 * C44) + (5 * C45) + (4 * C46) + (3 * C47) + (2 * C48) + (C49)) / 1275
I plotted it using the price scale and it looks real nice. It also compares nicely with the front weighted average in SnapSheets!
Bill
|
|
Guest-1 |