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 |

Recent 20 Day High PCF Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
willie moe
Posted : Tuesday, December 27, 2011 11:55:54 PM
Registered User
Joined: 8/25/2010
Posts: 117
Bruce,
I am looking for help in creating a pcf that will show the recent (not today) 20 day high price.
Thanks,
William
Bruce_L
Posted : Wednesday, December 28, 2011 7:37:32 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
How recent? Is the 20-Day High the current 20-Day High or was it the 20-Day High at the time? Does the symbol merely need to be at its 20-Day High at the time or does it need to have made a new 20-Day High?

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
willie moe
Posted : Wednesday, December 28, 2011 11:47:27 AM
Registered User
Joined: 8/25/2010
Posts: 117
I am looking for pullbacks here.
Let's make it the current 20-Day High and it was at it's 20-Day High at the time

William
Bruce_L
Posted : Thursday, December 29, 2011 8:24:47 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
I'm still not quite sure what you want, so let's look at the structure of the MAXH syntax of the Personal Criteria Formula Language.

PCF Formula Descriptions

MAXHx.z -> Maximum of High Price

Where x is the Period of the Indicator or Function.
Where z is the number of Periods Ago.
- z can also be a date. May 3, 2007 would be (single quotes required): '05/03/07'

The arguments in indicators are separated by periods.

So the actual value of the 20-Period High would be:

MAXH20

The actual value of the 20-Period High of 10-Bars Ago would be:

MAXH20.10

A Boolean (True or False) formula for the High of the current Bar being less than 20-Day High of the previous Bar would be:

H < MAXH20.1

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Wednesday, April 11, 2012 1:26:53 PM
Registered User
Joined: 1/28/2012
Posts: 62

Hi Bruce,

This line of inquiry is along the the line of Dave Landry's method of scanning.

We're looking for a 20-day High sometime in the last 8 days, not including today. In other words, the stock will have pulled back from a 20-day High some time in the last 8 days.

The PCF I wrote for this (thanks to your advice to other posters) is:

C1>=MAXH20.2 or C2>=MAXH20.3 or C3>=MAXH20.4 or C4>=MAXH20.5 or C5>=MAXH20.6 or C6>=MAXH20.7 or C7>=MAXH20.8 or C8>=MAXH20.9

Is this correct? On the charts, it seems to be. \

Thanks! 

Bruce_L
Posted : Wednesday, April 11, 2012 1:38:45 PM


Worden Trainer

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

Your formula is for the close being as high or higher than the highest high in the previous 20-bars during at least one of the prior 8-bars.

I do not know if this is what you want or not, but it does not seem to incorporate the concept of a pullback.

A formula for a 20-bar high happening during one of the prior 8-bars with all of the highs since being below this high could be written as:

(H < H1 AND H1 = MAXH20.1) OR (MAXH2 < H2 AND H2 = MAXH20.2) OR (MAXH3 < H3 AND H3 = MAXH20.3) OR (MAXH4 < H4 AND H4 = MAXH20.4) OR (MAXH5 < H5 AND H5 = MAXH20.5) OR (MAXH6 < H6 AND H6 = MAXH20.6) OR (MAXH7 < H7 AND H7 = MAXH20.7) OR (MAXH8 < H8 AND H8 = MAXH20.8)



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Gone South
Posted : Wednesday, April 11, 2012 3:46:49 PM
Registered User
Joined: 1/28/2012
Posts: 62

Wow! Thanks for the lightening fast turnaround, Bruce.

Your description is correct, so your formula should also be what I need. 

Landry's idea is that the stock has been trending for 20 days, but has fallen from its high sometime during the last 8 days, not including the most recent close. That means that the stock has pulled back from the 20-day high sometime during those 8 days, even if only the very last close. Longer than 8 days, according to Landry, may be a correction and not a pullback.

The result of the scan (along with his other conditions) should be a selection of stocks that have done well during the last month or so, but have recently fallen from the swing high... that is, pulled back from a strong trend.

Thanks for the PCF! Worden really should catalog all your work over the years. You've produced a vast number of PCFs and are no doubt a bit weary of doing them over again or referencing them because users haven't found them it the discussion boards. There's a wiki wating to be born, I'm sure.

kenjanson
Posted : Thursday, April 12, 2012 5:19:12 PM
Registered User
Joined: 12/21/2004
Posts: 35

Hi Bruce,

Why do I get the error message "argument missing near =" on entering  this formula in tc2000.com? It works fine in tc2007.

StockGuy
Posted : Thursday, April 12, 2012 5:58:01 PM

Administration

Joined: 9/30/2004
Posts: 9,187

I can only assume you did not paste the entire formula.  I just pasted this into TC2000.com v12 and it's working fine.

 

(H < H1 AND H1 = MAXH20.1) OR (MAXH2 < H2 AND H2 = MAXH20.2) OR (MAXH3 < H3 AND H3 = MAXH20.3) OR (MAXH4 < H4 AND H4 = MAXH20.4) OR (MAXH5 < H5 AND H5 = MAXH20.5) OR (MAXH6 < H6 AND H6 = MAXH20.6) OR (MAXH7 < H7 AND H7 = MAXH20.7) OR (MAXH8 < H8 AND H8 = MAXH20.8)

kenjanson
Posted : Friday, April 13, 2012 11:08:34 AM
Registered User
Joined: 12/21/2004
Posts: 35

That's strange because copy/paste does not seem to work in my TC2000.com. It will in TC2007 and I am able to copy/paste the formula from TC2007 to MS Word. Any thoughts?

Bruce_L
Posted : Friday, April 13, 2012 11:11:45 AM


Worden Trainer

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

You will need to use ctrl-v to paste something into TC2000 version 12.1.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
kenjanson
Posted : Friday, April 13, 2012 11:15:30 AM
Registered User
Joined: 12/21/2004
Posts: 35

Works great, thank you so much.

kenjanson
Posted : Thursday, April 19, 2012 3:12:05 PM
Registered User
Joined: 12/21/2004
Posts: 35

In tc2000, I would like to see a % True indicator consisting of the subject formula applied to my custom indicator: MAX(OBV,20) - OBV . In my attempts, the % True indicator acts on price, not my indicator, even though I click on the + in the custom formula line.

Can it be done?

 

Bruce_L
Posted : Thursday, April 19, 2012 3:49:43 PM


Worden Trainer

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

A Custom PCF % True Indicator acts on the formula itself as it written.

Since the following Condition Formula does not contain references to OBV or MAX(OBV,20) - OBV, it will be based on price and not OBV or MAX(OBV,20) - OBV:

(H < H1 AND H1 = MAXH20.1) OR (MAXH2 < H2 AND H2 = MAXH20.2) OR (MAXH3 < H3 AND H3 = MAXH20.3) OR (MAXH4 < H4 AND H4 = MAXH20.4) OR (MAXH5 < H5 AND H5 = MAXH20.5) OR (MAXH6 < H6 AND H6 = MAXH20.6) OR (MAXH7 < H7 AND H7 = MAXH20.7) OR (MAXH8 < H8 AND H8 = MAXH20.8)

While it would be possible to substitute OBV for price in the above formula:

(OBV < OBV1.1 AND OBV1.1 = MAX(OBV1.1,20)) OR (MAX(OBV,2) < OBV1.2 AND OBV1.2 = MAX(OBV1.2,20)) OR (MAX(OBV,3) < OBV1.3 AND OBV1.3 = MAX(OBV1.3,20)) OR (MAX(OBV,4) < OBV1.4 AND OBV1.4 = MAX(OBV1.4,20)) OR (MAX(OBV,4) < OBV1.5 AND OBV1.5 = MAX(OBV1.5,20)) OR (MAX(OBV,6) < OBV1.6 AND OBV1.6 = MAX(OBV1.6,20)) OR (MAX(OBV,7) < OBV1.7 AND OBV1.7 = MAX(OBV1.7,20)) OR (MAX(OBV,8) < OBV1.8 AND OBV1.8 = MAX(OBV1.8,20))

I do not know of a way to substitute MAX(OBV,20) - OBV for price into the formula which would create a formula short enough to be practical however.

The MAX() function cannot take formulas or other functions as arguments. While it would be theoretically possible to manually expand all of the MAX() functions required using the technique given in the Min Max PCFs topic, the resulting formula would be to long and slow to be practical or for me to post in the forums.



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Clarasofia
Posted : Sunday, October 7, 2012 12:45:28 AM
Registered User
Joined: 9/24/2012
Posts: 1

Hi Bruce,

Can you help with A formula for a 20-bar low happening during one of the prior 8-bars with all of the lows

In this April, you helped with the HIGHs as below, now can you help with LOWs.

Really appreciate your help !

(H < H1 AND H1 = MAXH20.1) OR (MAXH2 < H2 AND H2 = MAXH20.2) OR (MAXH3 < H3 AND H3 = MAXH20.3) OR (MAXH4 < H4 AND H4 = MAXH20.4) OR (MAXH5 < H5 AND H5 = MAXH20.5) OR (MAXH6 < H6 AND H6 = MAXH20.6) OR (MAXH7 < H7 AND H7 = MAXH20.7) OR (MAXH8 < H8 AND H8 = MAXH20.8)

Bruce_L
Posted : Monday, October 8, 2012 9:21:26 AM


Worden Trainer

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

Inverting the 20-bar high formula into a 20-bar low formula would result in the following:

(L > L1 AND L1 = MINL20.1) OR (MINL2 > L2 AND L2 = MINL20.2) OR (MINL3 > L3 AND L3 = MINL20.3) OR (MINL4 > L4 AND L4 = MINL20.4) OR (MINL5 > L5 AND L5 = MINL20.5) OR (MINL6 > L6 AND L6 = MINL20.6) OR (MINL7 > L7 AND L7 = MINL20.7) OR (MINL8 > L8 AND L8 = MINL20.8)



-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.