Welcome Guest, please sign in to participate in a discussion. | Search | Active Topics | |
Registered User Joined: 2/11/2013 Posts: 78
|
I'm trying to write a PCF to scan for trading that has been in a "rounded bottom" pattern...and I'm stumped.
Ideally, it would identify rounded bottoms of various lengths (numbers of bars). However, if we had to hard-code the length of the rounding bottom, I'd say 10 bars.
Can you help?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
Condition Formulas to identify price patterns will in general be designed for fixed widths. If you want to check for same type of patterns over multiple possible periods, you would normally need to create a check for each period of interest and then OR all of the individual formulas together into a single formula.
I am only aware of one formula for a rounded bottom posted in the formulas previously, and I really don't know what about it would cause it to return true for rounded bottoms while returning false for other symbols.
Rounded bottom pcf (condition)
To create a Condition Formula for a rounded bottom, we would need a specific unambiguous objective definition of the pattern you are attempting to identify.
For example, if we defined a rounded bottom over 10-bars as the 6-Period Linear Regression Slope and net change over that period being positive, the 6-Period Linear Regression Slope and net change over the period ending 4-bars ago being negative and the highs of the start and end of the 10-bar period being above all of the highs in between, we would get:
C > C5 AND AND 5 * (C - C5) + 3 * (C1 - C4) + C2 > C3 AND C4 < C9 AND 5 * (C4 - C9) + 3 * (C5 - C8) + C6 < C7 AND H > MAXH8.1 AND MAXH8.1 < H9
But if we change the requirements, we would need to adjust the formula as well. What those requirements might be are up to you.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/11/2013 Posts: 78
|
Bruce:
I tried the formula from that other thread. I found that formula returned mostly non-rounding bottoms (mostly chaff with a little wheat) when I ran it the last couple days.
I'll play with idea you propose and report back if that or some variation works.
Thanks for the help.
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I'm sure it will require work to be useful. I threw together some "well it seems like this might be true" type requirements together to create the formula. There are probably other characteristics that would be more definitive and/or more correlated with the type of pattern you are looking for.
If you can come up with the specifics of the definition, we might be able to help you with creating the formula to identify your definition.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/11/2013 Posts: 78
|
I'm going to try using the %D from Stochastics as my mechanism. However, I get a formula error. TC2000 is fine with both sides of my equation, but fails when I make one greater than the other.
AVG3(STOC12.3.5) > AVG3(STOC12.3.4)
Have any ideas?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The 3 needs to be the second term after a comma inside the parentheses. I'm not entirely sure of your intent, but I'm guessing you want:
AVG(STOC12.3.5,3) > AVG(STOC12.3.4,3)
Both 3s in each side of the formula are 3-Period Simple Moving Averages. The .5 and .4 are the number of bars ago.
Understanding Stochastics
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/11/2013 Posts: 78
|
Bruce I've decided on a 2-prong approach. First, I'm manually looking for:
- 2 down days
- 3 down or flat days
- 2 up days.
That's pretty easy and I have it working.
Then I'm going to add in a filter based on the "5-day regression slope" from 2 days ago. In that way I can limit results to slow rounding bottoms.
So I need a formula for 5day regression slope as of 2 bars ago. Can you help me on that?
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
The 5-Period Linear Regression Slope of 2-bars ago could be written as:
(2 * C2 + C3 - C5 - 2 * C6) / 10
Note that C4 is not involved in the calculations at all. This is why I normally try to use even periods for Linear Regression Slopes whenever possible. The 4-Period Linear Regression Slope of 2-bars ago could be written as:
(1.5 * C2 + .5 * C3 - .5 * C4 - 1.5 * C5) / 5
And the 6-Period Linear Regression Slope of 2-bars ago could be written as:
(2.5 * C2 + 1.5 * C3 + .5 * C4 - .5 * C5 - 1.5 * C6 - 2.5 * C7) / 17.5
Using Linear Regression vs Classical Peaks/Valleys for Divergence Analysis
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Registered User Joined: 2/11/2013 Posts: 78
|
Bruce,
I'm hoping you can help me understand what's going on here. BTW, I read the linked thread and found it sueful, but can't explain my results.
I derived 2 period regression slope formulas for the last 5 pairs of days as follows:
(0.5 * C) + (-0.5 * C1) / 0.5 >
(0.5 * C1) + (-0.5 * C2) / 0.5 >
(0.5 * C2) + (-0.5 * C3) / 0.5 >
(0.5 * C3) + (-0.5 * C4) / 0.5 >
(0.5 * C4) + (-0.5 * C5) / 0.5
I expected that to return stocks with an ever increasing slope between C5 and C. Run today, it returns all US Stocks (or extremely close to that number = 5,568). I also created a couple indicators (from the first 2 lines of code above, minus the >) to add to the scan results to check what was going on. I do not understand the results.
First of all, all the slopes shown from my 2 indicators are negative (the largest being about -1). This makes no sense. Second the difference in slope between C-C1 and C1-C2 do not track.
Take for example NOR. NOR's C2 value was $3.35, its C1 value was $3.30 and it's C value was $4.45 (a 35% gain today). To me that means it had a negative slope from C2 to C1 and then a sharply positive slope from C1 to C. My indicators return values of -1.08 (C-C1) and -1.70 (C1-C2).
Compare this to (for example) PULS. PULS had a C2 value of $0.33, a C1 value of $0.35 and a C value of $0.34. First of all, in my mind this had a positve slope C2 to C1 and a negative slope C1 to C. So it should not have been returned by the pcf...or at least I dno't understand why it was returned. Second, the indicator values for that stock are -0.15 (C1-C2) and -0.18 (C-C1).
So...can you help me sort this out?
|
|
Registered User Joined: 2/11/2013 Posts: 78
|
Bruce,
Doh...I see my problem. Like a dummy I left out a set of brackets surrounding each numerator and apparently needed to have only 1 comparison before an "AND". So now I get the same values that I manually calculate and expect based on visual inspection.
I added some steepness filters (so I can find only slow rounding curves) and my revised formulas are:
((0.5 * C) + (-0.5 * C1)) / 0.5 > ((0.5 * C1) +(-0.5 * C2)) / 0.5 AND
((0.5 * C1) +(-0.5 * C2)) / 0.5 >= ((0.5 * C2) +(-0.5 * C3)) / 0.5 AND
((0.5 * C2) +(-0.5 * C3)) / 0.5 >= ((0.5 * C3) +(-0.5 * C4)) / 0.5 AND
((0.5 * C3) +(-0.5 * C4)) / 0.5 >= ((0.5 * C4) +(-0.5 * C5)) / 0.5 AND
((0.5 * C) + (-0.5 * C1)) / 0.5 <= 0.12 AND
((0.5 * C1) +(-0.5 * C2)) / 0.5 <= 0.12 AND
((0.5 * C2) +(-0.5 * C3)) / 0.5 <= 0.12 AND
((0.5 * C3) +(-0.5 * C4)) / 0.5 <= 0.12 AND
((0.5 * C4) +(-0.5 * C5)) / 0.5 <= 0.12 AND
((0.5 * C) + (-0.5 * C1)) / 0.5 >= 0 AND
((0.5 * C1) +(-0.5 * C2)) / 0.5 >= -0.12 AND
((0.5 * C2) +(-0.5 * C3)) / 0.5 >= -0.12 AND
((0.5 * C3) +(-0.5 * C4)) / 0.5 >= -0.12 AND
((0.5 * C4) +(-0.5 * C5)) / 0.5 >= -0.12
That formulas does a pretty good job of finding rounding bottoms
|
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
I am happy to read you were able to figure it out on your own. The technique is quite creative.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|
|
Guest-1 |