Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 3/10/2005 Posts: 16
|
I want to do a scan on a 3 day chart that will pick up those stocks where %K for today or any of the previous 5 days is below 20 and today's %K is above yesterday's %K. I wrote the following PCF, but it picks up stocks which violate one or both of the above criteria (see ARNA, TNS, MTN, MGI, MCDA, FLML, STEM, BLTI, and PRFT using data through October 10) :((STOC40.5 + STOC40.5.3 + STOC40.5.6 + STOC40.5.9 + STOC40.5.12)/5 > (STOC40.5.1 + STOC40.5.4 + STOC40.5.7 + STOC40.5.10 + STOC40.5.13) AND (((STOC40.5 + STOC40.5.3 + STOC40.5.6 + STOC40.5.9 + STOC40.5.12)/5 < 20 OR ((STOC40.5.1 + STOC40.5.4 + STOC40.5.7 + STOC40.5.10 + STOC40.5.13)/5) < 20 OR ((STOC40.5.2 + STOC40.5.5 + STOC40.5.8 + STOC40.5.11 + STOC40.5.14)/5 < 20 OR ((STOC40.5.3 + STOC40.5.6 + STOC40.5.9 + STOC40.5.12 + STOC40.5.15)/5) < ((STOC40.5.4 + STOC40.5.7 + STOC40.5.10 + STOC40.5.13 + STOC40.5.16)/5) < 20 OR (STOC40.5.5 + STOC40.5.8 + STOC40.5.11 + STOC40.5.14 + STOC40.5.17)/5 < 20)).
The PCF checks out; that is, there are no syntax errors (although there may be typos in the above).
Why am I getting stocks that fall outside one or both of the above criteria on a 3 day chart?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
What is the Period of the Stochastic?
What is the SK Period?
Is the Stochastic Simple or Exponential?
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/10/2005 Posts: 16
|
The stochastic is the 40.5 simple.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you really "previous 5 days" and "today's %K is above yesterday's %K" on a three day Chart, please try the following:
STOC120 + STOC120.1.3 + STOC120.1.6 + STOC120.1.9 + STOC120.1.12 > STOC120.1.1 + STOC120.1.4 + STOC120.1.7 + STOC120.1.10 + STOC120.1.13 AND ((STOC120 + STOC120.1.3 + STOC120.1.6 + STOC120.1.9 + STOC120.1.12) / 5 < 20 OR (STOC120.1.1 + STOC120.1.4 + STOC120.1.7 + STOC120.1.10 + STOC120.1.13) / 5 < 20 OR (STOC120.1.2 + STOC120.1.5 + STOC120.1.8 + STOC120.1.11 + STOC120.1.14) / 5 < 20 OR (STOC120.1.3 + STOC120.1.6 + STOC120.1.9 + STOC120.1.12 + STOC120.1.15) / 5 < 20 OR (STOC120.1.4 + STOC120.1.7 + STOC120.1.10 + STOC120.1.13 + STOC120.1.16) / 5 < 20 OR (STOC120.1.5 + STOC120.1.8 + STOC120.1.11 + STOC120.1.14 + STOC120.1.17) / 5 < 20)
But if you actually mean Bars instead of Days, you might wish to try the following instead:
STOC120 > STOC120.1.15 AND ((STOC120 + STOC120.1.3 + STOC120.1.6 + STOC120.1.9 + STOC120.1.12) / 5 < 20 OR (STOC120.1.3 + STOC120.1.6 + STOC120.1.9 + STOC120.1.12 + STOC120.1.15) / 5 < 20 OR (STOC120.1.6 + STOC120.1.9 + STOC120.1.12 + STOC120.1.15 + STOC120.1.18) / 5 < 20 OR (STOC120.1.9 + STOC120.1.12 + STOC120.1.15 + STOC120.1.18 + STOC120.1.21) / 5 < 20 OR (STOC120.1.12 + STOC120.1.15 + STOC120.1.18 + STOC120.1.21 + STOC120.1.24) / 5 < 20 OR (STOC120.1.15 + STOC120.1.18 + STOC120.1.21 + STOC120.1.24 + STOC120.1.27) / 5 < 20)
You may wish to review the following:
Understanding Stochastics
How to create a Personal Criteria Forumula (PCF)
PCF Formula Descriptions
Handy PCF example formulas to help you learn the syntax of PCFs!
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/10/2005 Posts: 16
|
Bruce: In my question I said I wanted to scan on a 3 day chart; which do you consider this to be -- days or bars?
Otto
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Your question said, "I want to do a scan on a 3 day chart that will pick up those stocks where %K for today or any of the previous 5 days is below 20 and today's %K is above yesterday's %K."
I can't say, the sentence is ambiguous. You start by referencing a 3-Day Chart. This portion seems clear in that you want 3-Days per Bar.
The second part uses "previous 5 days", "today" and "yesterday". In the context of a Daily Chart, these terms would be clear. In the context of a 3-Day Chart however, they are not.
You could in fact mean exactly what these phrases say. You could be looking at a 3-day Chart over a period of 6-Trading Days (today and the previous 5 days). If this is the case, you would see today and 3-Days ago on Today's Chart, but Yesterday, 2-Days Ago, 4-Days Ago and 5-Days Ago would not be visible on Today's Chart.
You could instead be using the phrases "previous 5 days", "today" and "yesterday" to refer to the previous 5-Bars, the current Bar and the previous Bar. If this is the case, all of the Bars would be visible, but today would refer to the current 3-Day Bar, yesterday would actually refer to the 3-Day Bar from 3-Days Ago, 2-Days Ago would actually refer to the 3-Day Bar from 6-Days Ago, 3-Days Ago would actually refer to the 3-Day Bar from 9-Days Ago, 4-Days Ago would actually refer to the 3-Day Bar from 12-Days Ago and 5-Days Ago would actually refer to the 3-Day Bar from 15-Days Ago.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/10/2005 Posts: 16
|
Bruce: I apologize for any ambiguity in the question. What I meant is I want to do a scan every day that will pick up, on a 3 day chart, those stocks where %K for that day or any of the previous 5 days is below 20 and that day's %K is above the previous day's %K.
Otto
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you mean literally what you just said, then you should try the first formula given in my Wednesday, October 15, 2008 1:16:14 PM ET post. Just realize that the chart will not visually appear to match your description.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 3/10/2005 Posts: 16
|
What do you mean by "will not visually appear to match your description"? If the stochastics plot isn't what I want, doesn't that mean that the price movement also isn't what I want?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I mean that on a 3-Day Chart, when you look at the Chart, the Bars are 3-Days long, so when you look at the current Chart, you are not seeing Yesterday's, 2-Days Ago's, 4-Days Ago's and 5-Days Ago's 3-Day Bars on the current 3-Day Chart.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |