Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 10/7/2004 Posts: 3
|
Hi to all,
I am a TC2000 user.
I want to write a PERSONAL CRITERIA FORMULA to indentify stocks that are hitting NEW 52-WEEK HIGH for the first time.
Currently I am using H >= MAXH250.1 . The problem with this formula is once a stock hits 52-week high, and keep rising, it stays in the list.
How can I write a personal criteria formula that ONLY finds stocks that hits NEW 52-week high FOR THE FIRST TIME.
Thanks - Marcus
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Marcus, You may find the information in the 1st New High thread useful:
1st New High
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
Hi, Marcus:
Actually your seemingly simple question needs a little refinement, in order to be dealt with properly.
When you ask for the "first new 52wk high", what do you mean by "first"? That is:
1) First, since when? Since a month ago? (ie no other 52-week highs set in the last month?)
2) Are you looking for the highest high since a year ago, and wondering if today is the only day that hit it?
3) Do you want to compare today's situation vs today's 52-weeks-ago window to prior days' relation to their own 52-week highs?
All of these descriptions could potentially fit your original question, but they all require considerably different mathematical solutions ... some of which are pretty durn long PCF's.
I'm confident that a good solution can be created, but ya gotta define the problem a little more clearly, first.
Jim Dean
|
|
Registered User Joined: 10/7/2004 Posts: 3
|
Bruce and Jim,
Thank you very much for replying.
Jim, you ask very good questions. What I am looking for is close to number 2 in your post: "Are you looking for the highest high since a year ago, and wondering if today is the only day that hit it"
I want to find the stock that hits 52-week high for the 1st time since a year ago. I am not interested in it the second day if it keeps rising and obviously hits another 52-week high.
Hopefully that makes it clearer. Thank you
|
|
Registered User Joined: 10/7/2004 Posts: 799 Location: Duluth, GA
|
Hi, Marcus:
Thanks for the clarification.
Here's what you are looking for, I think. I've taken the "long road" to get to the answer, to hopefully explain it better ... CAUTION ... this will take a while to recalc and type out, UNLESS you read all the way to the bottom of the email and agree with that final conclusion. Note that this uses your original 250-trading days/year assumption. )TC uses 253 for its plotting functions.)
H > MaxH250.1 and H1 < MaxH249.2 and H2 < MaxH248.3 and ... you fill in the middle ones :~) and H248 < MaxH2.249
The speed of this can be improved somewhat by minimizing the boolean operators, by using the fact that a boolean expression such as (A>B), when wrapped in paren's, can be used in an algebraic formula. If (A>B) is true, it resolves to a minus-one; if false, it becomes a zero.
H>=MaxH250.1 and 0 = ( (H1>=MaxH249.2) + (H2>=MaxH248.3) + ... you fill in the middle ones :~) + (H248>=MaxH2.249) )
This will return a "True" if today's high is the first one that has exceeded the prior highs since one year ago. That is, if 250 days ago you start tracking the highs, then no High since then has been the max during that period.
Note that this means all the Highs since 250 days ago, except for today, have been LOWER that the high *OF* 250 days ago. If that were not true, then one of the intermediate clauses would have been true, which would have meant that the "0=" would have been false, which would have made the whole thing false.
So ... when you think of it that way, you can DRAMATICALLY simplify this by asking:
Is the High of 250 days ago higher than all subsequent days, EXCEPT FOR TODAY? That is easily stated in a PCF as:
H250 > MaxH248.1 and H >= H250
And that is the answer, I believe, to the question that you posed originally (if I understand you properly, re the "number 2" approach).
**********************************
FWIW, you might reconsider the question that you are asking, and instead create a PCF that returns an answer that tells you:
How many days has it been since a High has exceeded a sliding-window 52-week High?
This has been dealt with in a prior posting: "Days Since Last Peak (or other day-counting needs)" at: Days Since Last Peak (or other day-counting needs)
I hope this helps!
Jim Dean
|
|
Registered User Joined: 10/7/2004 Posts: 3
|
Thank you Jim. I will try it and let you know. Marcus
|
|
Guest-1 |