Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/7/2004 Posts: 7
|
Hi, I'm generally pretty good at writing PCFs, but this one has me stumped.
I want to create a PCF for the 3 SMA crossing the 18 SMA to be used on a weekly chart.
I know that PCFs run on a daily charts w/ daily data, but what numbers do I use for that PCF to run on a weekly chart.
I would put this PCF in the Sort and play it against a large list of stocks or include it in a EasyScan w/ other criteria.
Thanks,
Harold Kuhn
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The following should find crossovers in either direction:
SGN(5 * (C + C5 + C10) - C15 - C20 - C25 - C30 - C35 - C40 - C45 - C50 - C55 - C60 - C65 - C70 - C75 - C80 - C85) - SGN(5 * (C5 + C10 + C15) - C20 - C25 - C30 - C35 - C40 - C45 - C50 - C55 - C60 - C65 - C70 - C75 - C80 - C85 - C90) <> 0
You could change the <> to a > to find the Weekly SMA3 crossing up through the Weekly SMA18 or to a < to find the Weekly SMA3 crossing down through the Weekly SMA18.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 7
|
Thanks a lot!
Now can you tell me what "SGN" stands for and basically what the formula says and how it applies? I think I said that right.
Harold Kuhn
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
SGN() is the sign function and returns 1 if its argument is positive, 0 if its argument is zero and -1 if its argument is negative.
The formula in my Thursday, March 09, 2006 3:24:45 PM post is based on the following daily formula:
SGN(AVGC3 - AVGC18) - SGN(AVGC3.1 - AVGC18.1)
Where:
AVGC3 = Today's 3-Period Simple Moving Average of Price AVGC18 = Today's 18-Period Simple Moving Average of Price AVGC3.1 = Yesterday's 3-Period Simple Moving Average of Price AVGC18.1 = Yesterday's 18-Period Simple Moving Average of Price
The idea is that if AVGC3 - AVGC18 and AVGC3.1 - AVGC18.1 both have the same sign, the moving averages have not crossed. If they do not, it is possible to determine the directions based on the result:
+2: AVGC3 crossed up through AVGC18 +1: AVGC3 crossed up through AVGC18 (but AVGC3 was, or is, = to AVGC18) 0: AVGC3 and AVGC18 did not cross -1: AVGC3 crossed down through AVGC18 (but AVGC3 was, or is, = to AVGC18) -2: AVGC3 crossed down through AVGC18
These daily components need to be converted into weekly formulas. For example:
AVGC3 becomes (C + C5 + C10) / 3
Where:
C = Today's Price C5 = Close 5-Periods Ago C10 = Close 10-Periods Ago
Substituting the weekly versions and combining terms creates the formula except that everything has a bunch of "/18"s all over the place which can all be removed since the magnitude of the results do not matter, just their sign.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/23/2005 Posts: 39
|
Hi, Bruce Could please help me with AVGC3 cross over AVGC16 for 3 days chart. Thanks
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Please try the following:
SGN(13 * (C + C3 + C6) - 3 * (C9 + C12 + C15 + C18 + C21 + C24 + C27 + C30 + C33 + C36 + C39 + C42 + C45)) - SGN(13 * (C3 + C6 + C9) - 3 * (C12 + C15 + C18 + C21 + C24 + C27 + C30 + C33 + C36 + C39 + C42 + C45 + C48)) <> 0
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 7/23/2005 Posts: 39
|
thanks lot. Song
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |