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 |

Made a New 52-Week High in Last 20 Days Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
dhbyrge
Posted : Tuesday, March 26, 2013 11:30:59 AM
Gold Customer Gold Customer

Joined: 3/19/2008
Posts: 5

The following PCF returns TRUE when a stock has made a 52-week high within the last 20 trading days including today. Unfortunately, the calculation speed is slow, presumably due to the repeated use of MAXH260.

Do you have any ideas on how this formula might be coded more efficiently?

( H = MAXH260 ) OR ( H1 = MAXH260.1 ) OR ( H2 = MAXH260.2 ) OR

( H3 = MAXH260.3 ) OR ( H4 = MAXH260.4 ) OR ( H5 = MAXH260.5 ) OR

( H6 = MAXH260.6 ) OR ( H7 = MAXH260.7 ) OR ( H8 = MAXH260.8 ) OR

( H9 = MAXH260.9 ) OR ( H10 = MAXH260.10 ) OR ( H11 = MAXH260.11 ) OR

( H12 = MAXH260.12 ) OR ( H13 = MAXH260.13 ) OR ( H14 = MAXH260.14 ) OR

( H15 = MAXH260.15 ) OR ( H16 = MAXH260.16 ) OR ( H17 = MAXH260.17 ) OR

( H18 = MAXH260.18 ) OR ( H19 = MAXH260.19 )

Thank you.

Bruce_L
Posted : Tuesday, March 26, 2013 11:52:43 AM


Worden Trainer

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

I cannot think of a way which would return exactly the same results. We could do something like the following:

MAXH20 = MAXH260

But to get the same results, we would still have to make nineteen more checks:

MAXH20 = MAXH260 OR H1 = H260 OR H2 = MAXH2.260 OR H3 = MAXH3.360 OR H4 = MAXH4.360 OR H5 = MAXH5.260 OR H6 = MAXH6.260 OR H7 = MAXH7.260 OR H8 = MAXH8.260 OR H9 = MAXH9.260 OR H10 = MAXH10.260 OR H11 = MAXH11.260 OR H12 = MAXH12.260 OR H13 = MAXH13.260 OR H14 = MAXH14.260 OR H15 = MAXH15.260 OR H16 = MAXH16.260 OR H17 = MAXH17.260 OR H18 = MAXH18.260 OR H19 = MAXH19.260

While it might be marginally more efficient because of the shorter periods used, it actually requires the use of an extra MAXH term compared to the original version.

A better option which would only work in TC2000 version 12.3 might be to try and use the base Condition Formula:

H = MAXH260

As the Boolean Formula in a Custom PCF % True Indicator with the Period set to 20 and the Average Type set to Simple. This Custom PCF % True Indicator would be greater than 0 only if the Boolean Formula was true during at least one of the most recent 20 bars. This would allow you to click on the Custom PCF % True Indicator and select Create Scan Condition to create a Condition for the Custom PCF % True Indicator being greater than 0 to replicate the original Condition Formula.

Create Conditions from Your Chart



-Bruce
Personal Criteria Formulas
TC2000 Support Articles
dhbyrge
Posted : Tuesday, March 26, 2013 6:11:32 PM
Gold Customer Gold Customer

Joined: 3/19/2008
Posts: 5

Bruce, thank you for the suggestion to use a Custom PCF % True indicator. I will try it using verson 12.3.

Bruce_L
Posted : Wednesday, March 27, 2013 8:15:44 AM


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.