Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

Scan for price approaching recent high after pullback Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
derekb1959
Posted : Wednesday, June 21, 2017 11:50:49 AM
Registered User
Joined: 11/21/2016
Posts: 16

I'm trying to develop a scan to find stocks "approaching" (not yet hitting) recent highs after they made a pullback. Then I can watch "manually" for a breakout. The 5 recent examples I will embed below all had great breakouts, but finding it the "day after" the breakout is too late. The high occurs within the last 30 bars or so. The scan needs to trigger about 10% below the recent high because these can move fast.

Some of these look like big channels, but others are not. Finding an established channel and buying at support is another setup I am seeing here. That would be a different scan to find it approaching a recent bottom, but maybe similar logic.

Thanks for any help, Derek

derekb1959
Posted : Wednesday, June 21, 2017 12:01:09 PM
Registered User
Joined: 11/21/2016
Posts: 16

I tried to embed those images at only 720 pixels wide, using the Width field in the Image button, but they ended up displaying huge, even bigger than my originals, which makes reading the post annoying. Sorry, I can't figure it out.

Is there anyway to simply display a thumbnail of the image, then click to see the full size?

 

-Derek

Bruce_L
Posted : Wednesday, June 21, 2017 1:33:32 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

It appears to be a bug in the forums. The image gets resized in the editor but not in the final post.

If you really want to exclude days that hit the high, then I would probably write something like the following.

(MAXH30 - H < (MAXH30 - MINL30) / 4 AND MAXH20.10 = MAXH30 AND MAXH30 - MINH19.1 > (MAXH30 - MINL30) / 2) OR (MAXH27 - H < (MAXH27 - MINL27) / 4 AND MAXH18.9 = MAXH27 AND MAXH27 - MINH17.1 > (MAXH27 - MINL27) / 2) OR (MAXH24 - H < (MAXH24 - MINL24) / 4 AND MAXH16.8 = MAXH24 AND MAXH24 - MINH15.1 > (MAXH24 - MINL24) / 2) OR (MAXH21 - H < (MAXH21 - MINL21) / 4 AND MAXH14.7 = MAXH21 AND MAXH21 - MINH13.1 > (MAXH21 - MINL21) / 2) OR (MAXH18 - H < (MAXH18 - MINL18) / 4 AND MAXH12.6 = MAXH18 AND MAXH18 - MINH11.1 > (MAXH18 - MINL18) / 2) OR (MAXH15 - H < (MAXH15 - MINL15) / 4 AND MAXH10.5 = MAXH15 AND MAXH15 - MINH9.1 > (MAXH15 - MINL15) / 2)

But this doesn't return true for the first hit on your CARB chart because the breakout day goes above the previous high. In order to include this hit, we would have to exclude the current bar when calculating the high for one of the checks.

(MAXH30 - H < (MAXH30 - MINL30) / 4 AND MAXH20.10 = MAXH29.1 AND MAXH30 - MINH19.1 > (MAXH30 - MINL30) / 2) OR (MAXH27 - H < (MAXH27 - MINL27) / 4 AND MAXH18.9 = MAXH26.1 AND MAXH27 - MINH17.1 > (MAXH27 - MINL27) / 2) OR (MAXH24 - H < (MAXH24 - MINL24) / 4 AND MAXH16.8 = MAXH23.1 AND MAXH24 - MINH15.1 > (MAXH24 - MINL24) / 2) OR (MAXH21 - H < (MAXH21 - MINL21) / 4 AND MAXH14.7 = MAXH20.1 AND MAXH21 - MINH13.1 > (MAXH21 - MINL21) / 2) OR (MAXH18 - H < (MAXH18 - MINL18) / 4 AND MAXH12.6 = MAXH17.1 AND MAXH18 - MINH11.1 > (MAXH18 - MINL18) / 2) OR (MAXH15 - H < (MAXH15 - MINL15) / 4 AND MAXH10.5 = MAXH14.1 AND MAXH15 - MINH9.1 > (MAXH15 - MINL15) / 2)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
derekb1959
Posted : Wednesday, June 21, 2017 10:54:39 PM
Registered User
Joined: 11/21/2016
Posts: 16

Bruce,

Thank you. Your brain works in amazing ways.

I added a simple condition for up trend AVGC20>AVGC50 and a volume condition and the number of results is very manageable and very interesting.

I needed to parse it out to decipher your logic into a "word problem" to be sure I understand it. Then I can play with the numbers. I'm embarrassed to say how long it took me to figure it out. I know your syntax does not support the semicolon, I'm just using it temporarily to add my notes. Please confirm "I got it".

Thanks, Derek

 

;The first check applies to a 30 day test period. The subsequent checks are the same except for shorter periods 27, 24, 21, 18 and 15 days.

(MAXH30 - H < (MAXH30 - MINL30) / 4; Current high is in the upper 25% of range of last 30 day test period. Could multiply by 0.25, instead of divide by 4, more intuitive for me.

AND

MAXH20.10 = MAXH30; Max high within oldest 2/3 of 30 day test period equals max high of the 30 day period. I don&rsquo;t understand this one. Why &ldquo;equal&rdquo;?

AND

MAXH30 - MINH19.1 > (MAXH30 - MINL30) / 2); All of the highs in the most recent 2/3 of the period are in the upper 50% of the range of the 30 day test period. Could multiply by 0.50 instead of divide by 2, more intuitive for me.

 
derekb1959
Posted : Wednesday, June 21, 2017 11:11:52 PM
Registered User
Joined: 11/21/2016
Posts: 16

Ugh, cutting and pasting in here is cumbersome. If you edit too much in here, the system gets confused and the POST button returns an error message and you have to start over. So I try to "compose" outside, then paste.

 

The 2nd term, my interpretation was as follows. You can see by what got pasted in my previous post, I did not understand it at first. But I think I got it:

 

MAXH20.10 = MAXH30; Max high occurred within the oldest 2/3 of the 30 day test period.

 

Thanks,

Derek

Bruce_L
Posted : Thursday, June 22, 2017 8:51:24 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You have it mostly right. I used the / 4 and / 2 instead of * 0.25 and * 0.50 for two reasons. It is slightly shorter. Some countries use a , as a decimal marker instead of using a . as a decimal marker, so avoiding the use of decimal markers makes it easier for those customers from those countries to follow the topic and copy and paste the formulas later.

The current high is in the top 25% of the range of the last 30 bars (exactly right). This is designed to check if prices are getting near the previous high.

MAXH30 - H < (MAXH30 - MINL30) / 4

Max high occurred within the oldest 2/3 of the 30 day test period (exactly right). Did this to identify the "recent high" before the pullback.

MAXH20.10 = MAXH30

At least one of the highs is in the bottom half of the range of the most recent 30 bars (almost the opposite of what you said). This is what identifies the pullback.

MAXH30 - MINH19.1 > (MAXH30 - MINL30) / 2

There is actually something missing from my post which I had in my testing (not sure how it didn't mae it into my copy and paste). I had the following at the beginning of the entire formula (it doesn't need to be included in each section).

H > H1 AND (rest of formula here inside these parentheses)

That was there to check to make sure the bar was actually moving closer to the previous high. It eliminated some of the results where price had already tested the previous high and started to move back down.

On another note, the periods included were just all the multiples of 3 between 15 and 30 (because I divided the range into 3 sections and it made the math easier). There is quite a bit of redundancy in checking 6 different periods and leaving some of the periods out doesn't make too much of a difference in the results.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
derekb1959
Posted : Thursday, June 22, 2017 2:32:05 PM
Registered User
Joined: 11/21/2016
Posts: 16

Understood about the dot . versus the comma , so I will stick with /4 and /2.

Ahah, the 3rd term, I had the logic wrong. I got it now! I had to re-think that one.

I added the H>H1 at the beginning and that cleaned up the results. Very nice. Especially when I added a simple up trend condition AVGC20>AVGC50 (and volume of course). I got only 50 results today - very manageable to sift through - perfect. It's no good when you get hundreds of results.

Thanks Bruce, this is awesome stuff!

-Derek

bcochrane
Posted : Thursday, June 22, 2017 5:42:23 PM
Registered User
Joined: 9/17/2010
Posts: 484

Another approach to consider, and for Bruce's comment:

CountTrue(XDown(C,HAvgC10),30) >0 and (There has been a Pull Back)

Hull Moving Average Moving Up Net Change 0.20 in Past Two Days and (Moving upward, not a PCF)

C=>MaxC30*.9 and C<MaxC30.5CountTrue(XDown(C,HAvgC10),30) >0 (Nearing recent High) AND

C>HAvgC10   Ensure hasn't slipped back downward

Tonight my attempt returned 101 stocks from HC1000, 63 of which were among the 126 returned by Bruce's scan.  I didn't pick up CDW because today's close was the Highest close in 30 days, but I did pick up CRM which looks to me to be a candidate. I'm not trying to turn this into a contest of who's better, but I saw the original post, thought is was such an obviously useful scan that I started to figure out how I would approach  it. I would be interested in any comments Bruce might have. I'm not sure, for example, if I have captured all the "requirements" from the originating post,nor I confess, hace I attempted to decode Bruce's PCF

Cheers

Bruce_L
Posted : Friday, June 23, 2017 9:15:45 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

I assumed the hull moving average was the 10 period you were using throughout the rest of the scan.

HAVGC10 >= HAVGC10.2 + 2 / 10

Resulting in the following combined formula.

CountTrue(XDown(C,HAvgC10),30) >0 AND C=>MaxC30*.9 and C < MaxC30.5 AND C>HAvgC10 AND HAVGC10 >= HAVGC10.2 + 2 / 10

Thare are usually lots of ways to do similar things in TC2000. In many cases it comes down to the exact definitions you want to use for various terms.

Your scan would seem to catch the uptrend sooner which could be a very good thing if you are trying to catch the uptrend and go long (I don't know if that is derekb1969's intent or not).

Using yesterday's close on a daily chart, there are 105 stocks in common from the US Common Stocks WatchList between the two scans. Your scan found 164 that mine did not. My scan fountd 320 yours did not. So your scan was also a bit more selective.

Probably more instructive in determining which approach would better suit your needs would be to plot both formulas as Custom PCF % True Indicators and then look at the chart.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
bcochrane
Posted : Friday, June 23, 2017 4:16:01 PM
Registered User
Joined: 9/17/2010
Posts: 484

If anyone wants to use Bruce's version of my scan, perhaps as a Watch List column, the correctformula for copy & pasteis

CountTrue(XDown(C,HAvgC10),30) >0 AND C=>MaxC30*.9 and C < MaxC30.5 AND C>HAvgC10 AND HAVGC10 >= HAVGC10.2 + 2 / 10

derekb1959
Posted : Sunday, July 2, 2017 10:47:51 PM
Registered User
Joined: 11/21/2016
Posts: 16

Bruce, can you further explain how to do what you mentioned, "Probably more instructive in determining which approach would better suit your needs would be to plot both formulas as Custom PCF % True Indicators and then look at the chart."

There is so much power in TC2000 that I don't understand yet.

-bcochrane, thanks for the complete formula. I will try both approaches. I need to spend some time to decipher the logic in the Hull version. In fact, the Hull version is giving some very interesting results not found by the other version.

Bruce commented that your Hull scan would catch the uptrend sooner. My intent is to find price that is approaching some very obvious recent price level that was resistance. Then look for either a short into that resistance, or a new breakout.

bcochrane
Posted : Monday, July 3, 2017 9:41:03 AM
Registered User
Joined: 9/17/2010
Posts: 484

Derek

FWIW, the Hull moving average should  work because it reduces lag, which is what I was experimenting with.

If the scan returns stocks not yet close enough (for you) to a resistance level, play with this part of the scan

C=>MaxC30*.9

particularly the .9 factor. Increasing it should produce results closer to a resistance level. Channging it to a value greater than 1 will return stocks which have cleared the recent resistance level.

Bruce_L
Posted : Monday, July 3, 2017 10:18:13 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

A Custom PCF % True Indicator is just a regular indicator, but it allows you to enter a Boolean Formula (a formula which returns true or false instead of a numeric value) as one of its settings. It will then plot spikes on the chart when it is true.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
derekb1959
Posted : Thursday, July 6, 2017 1:01:23 PM
Registered User
Joined: 11/21/2016
Posts: 16

bcochrane,

I am liking the results of the Hull scan as it is, finding stocks "on the way up" a bit earlier, and looking for plays to ride it back up to resistance. Thank you for explaining that tweek, I will experiment.

Bruce,

Thanks once again for your great information.

-Derek

Bruce_L
Posted : Thursday, July 6, 2017 1:09:31 PM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138

You're welcome.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.