Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 11/29/2006 Posts: 181
|
Hi,
I am looking for PCF that will tell me the number of periods since the last highest high within last 100 periods. Also, an opposite PCF that will return te number of periods since the last lowest low within last 100 periods.
Thank you.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The easiest thing to do for this is to use the Aroon Indicator for this.
Aroon and Aroon Oscillator
The format may not be exactly what you want, but it is way easier that actually writing the formulas.
Days Since Last Peak (or other day-counting needs)
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 11/29/2006 Posts: 181
|
Thank you Bruce.
|
|
Registered User Joined: 6/14/2016 Posts: 285
|
Hi Bruce,
I need to do a basic scan which should find stocks hat made their lowest low 240 days ago (as compared to the current low). I checked out the Aroon discussion, but couldn't eally find a formula for this which is independent of the highest high over the same lookback period and goes back 240 (trading) days.
How would you handle this?
Many thanks,
Chris
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
Do you mean the current low is lower than the low hit 240 days ago?
If so, then L241 = MINL240.1 and L < MINL240.1
Or are you just looking for stocks that as of today, made their lowest low 240 days ago?
L240 = MINL240
|
|
Registered User Joined: 6/14/2016 Posts: 285
|
Sorry Bruce, I didn't specify it correctly.
I'm looking fo stocks which made their lowest low 240 days ago, but have higher lows today.
The 240 day old low should be a significant low, but there may of course be lower lows following the
240 day low - so I guess your second formula would apply here.
Is there a way of specifying a lowest low date "range", e.g 220 to 250 days ago, rather than only one date at 240 days ago?
Thanks vey much.
Chris
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
No, you have to be specific in the PCF language.
|
|
Registered User Joined: 6/14/2016 Posts: 285
|
Perhaps we have a misunderstanding here:
The code for the lowest low made 240 days ago is the correct meaning, so L240 = MINL240
would be the correct specific PCF language as a starting point for my scan.
All I want to do is make a lowest low "date range" of [240 - 10] days and [240 + 10] days or
a lowest low occuring between 230 and 250 days prior to the current date.
Woud this be possibl to code? Thanks,
Chris
|
|
Administration
Joined: 9/30/2004 Posts: 9,187
|
L250 = MINL250 or L249 = MINL250 or L248 = MINL250, etc.
Just carry it out as far as you want to scan for the 250 bar low.
|
|
Registered User Joined: 6/14/2016 Posts: 285
|
Thanks much - that is the solution.
|
|
Registered User Joined: 6/14/2016 Posts: 285
|
Hi,
I'm still working on an EasyScan which is not quite complete yet and hope that you would help me with it. Here's what I need to scan for:
- stocks that made a new 3 year low 245 [trade] days ago (from the current date without weekends or holidays being counted)
- would like to have a tolerance to find this significant 3 year low 244, 245, or 246 days ago (245 +- 1 bar)
Secondly, as a totally separate condition, I would like the EMA(89) to be less than 5% below the current low, and the current high not more than 3% above the EA(89).
Thirdly, the 60-day slope of the EMA(89) should be greater than 0.
Many thanks for your help. Kind regards,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
A daily formula for a new 3 year low 245 trading days ago can be written, but it will not calculate in TC2000 v12/v17 because you will have at most 501 trading bars ago (but it should calculate in TC2000 v7).
L245 < MINL756.246
You could switch to a longer time frame, but you then would not be able to adjust the formula one trading day at a time and might need to use rougher approximations of the number of days in 3 years and the number of bars ago. In addition, the new low could have happened on any one of 3 trading days if you are are using a 3 day time frame for example.
The rest of the formula could be written as follows in a daily time frame for TC2000 v17.
XAVGC89 >= .95 * L AND H <= 1.03 * XAVGC89 AND 6 * (FAVGC60 - AVGC60) / 59 > 0
Or as follows for TC2000 v7.
XAVGC89 >= .95 * L AND H <= 1.03 * XAVGC89 AND 59 * (C - C59) + 57 * (C1 - C58) + 55 * (C2 - C57) + 53 * (C3 - C56) + 51 * (C4 - C55) + 49 * (C5 - C54) + 47 * (C6 - C53) + 45 * (C7 - C52) + 43 * (C8 - C51) + 41 * (C9 - C50) + 39 * (C10 - C49) + 37 * (C11 - C48) + 35 * (C12 - C47) + 33 * (C13 - C46) + 31 * (C14 - C45) + 29 * (C15 - C44) + 27 * (C16 - C43) + 25 * (C17 - C42) + 23 * (C18 - C41) + 21 * (C19 - C40) + 19 * (C20 - C39) + 17 * (C21 - C38) + 15 * (C22 - C37) + 13 * (C23 - C36) + 11 * (C24 - C35) + 9 * (C25 - C34) + 7 * (C26 - C33) + 5 * (C27 - C32) + 3 * (C28 - C31) + C29 > C30
Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/14/2016 Posts: 285
|
Hi Bruce,
Thanks vey much foir this info. I really do want to stick with the new version (v17).
Would L245 < MINL500.246 be the way to do it within the max time frame available here?
I'll then aso use the second formula:
XAVGC89 >= .95 * L AND H <= 1.03 * XAVGC89 AND 6 * (FAVGC60 - AVGC60) / 59 > 0
If I were to replace the 5% (below the low) and 3% (above the high) with e.g. 8% and 5%,
would I just ned to change the coefficients to .92 and .05?
Also, an I delete the AND 6 * (AVGC60 - AVGC60) / 59 > 0 in order to use it sepaately?
Thanksand kind regards,
Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You have to take into account both the period and the number of bars ago when adding up to 500 bars (also note that it is zero based in that the current bar is 0 bars ago). So the longest period we can generally assume to be true for non-IPOs would be something like the following.
L245 < MINL253.246
The coefficients would become .92 and 1.05.
Yes, you can remove the AND 6 * (FAVGC60 - AVGC60) / 59 from the end of the formula. The standalone formula would not have the AND however.
6 * (FAVGC60 - AVGC60) / 59
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 6/14/2016 Posts: 285
|
Thanks very much Bruce. Your support really makes it so much easier and efficient in dealing with custom TC2000 issues. Kind regards, Chris
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
You're welcome.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |