Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Gold Customer
Joined: 10/7/2004 Posts: 43
|
tyring to come up with a pcf for momentum, e.g., a 21-day MA of something like (c-24)
i tried
(c-c24) + (c1-c25) + (c2-c26) + (c3-c27) + (c4-c28) + (c5-c29) + (c6-c30) + (c7-c31) + (c8-c32) + (c9-c33) + (c10-c34) + (c11-c35) + (c12-c36) + (c13-c37) + (c14-c38) + (c15-c39) + (c16-c40) + (c17-c41) + (c18-c42) + (c19-c43) + (c20-c44) + (c21-c45) /21
but it did not produce the same line as when i added the MA indicator to the custom PCF, (c-c24)
tx for taking a look.
- rach 3 ( sir trainer)
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
There are two issues with the formula that I can see. You need to put parentheses around everything before dividing by 21 to force the correct order of operations and you are adding together 22 terms instead of 21 terms. You can resolve both issues as follows:
((C - C24) + (C1 - C25) + (C2 - C26) + (C3 - C27) + (C4 - C28) + (C5 - C29) + (C6 - C30) + (C7 - C31) + (C8 - C32) + (C9 - C33) + (C10 - C34) + (C11 - C35) + (C12 - C36) + (C13 - C37) + (C14 - C38) + (C15 - C39) + (C16 - C40) + (C17 - C41) + (C18 - C42) + (C19 - C43) + (C20 - C44)) / 21
That said, you could also write this as a much shorter formula:
AVGC21 - AVGC21.24
Even with these corrections, a Custom Indicator will not match the Moving Average however because they are not plotted on the same Scale. You may wish to review the following:
Plotting Custom Indicators with Examples
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 10/7/2004 Posts: 43
|
thanks for this. yes, shorter is better. i was fiddling around with the shorter route, but could not get
the indicator line to match the line that appears when i just add a MA to (c-c24), and the PCFs you
provide still have this shortcoming, so i am not sure how to move ahead. again, tx.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The values match, it just won't visually be on the same scale. You can demonstrate this for yourself by plotting the following two Custom Indicators (which will Plot on the same Scale):
Select Chart Template | Add Indicator | Indicator.
- Visible: Checked
- Center Zero Line: Checked
- Plot using price scale: Unchecked
- Smoothing Average: 21
- Average Type: Simple
- Indicator Formula: C - C24
Select Chart Template | Add Indicator | Indicator.
- Visible: Checked
- Center Zero Line: Checked
- Plot using price scale: Unchecked
- Smoothing Average: 1
- Average Type: Doesn't matter (because the Smoothing Average is 1)
- Indicator Formula: AVGC21 - AVGC21.24
If you are interested in a Plot visually lining up instead of its values, you can just add a Moving Average as a Child Indicator.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 10/7/2004 Posts: 43
|
you've raised something i wasn't aware of: smoothing average = moving average. i hadn't realized, or thought about, the idea that the smoothing factor was a time factor, i.e., days, weeks, etc.
so, when i add a smoothing number, i am essentially creating a MA of whatever formula i have entered as the 'indicator formula?'
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Yes, the Smoothing Average is either a Simple or Exponential Moving Average applied to the Indicator formula.
Keep in mind however that unless Plot using price scale is checked, each Custom Indicator is Plotting on its own Scale. The only reason that the two Custom Indicators given earlier line up on the same Scale is that they have exactly the same values.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Gold Customer
Joined: 10/7/2004 Posts: 43
|
sorry for the blank...thanks so much for shining a bright light in this coner of my darkened unawarenss.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |