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 |

PCF Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
marv73
Posted : Tuesday, March 22, 2005 3:53:07 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 10
Can you tell me if the following formula is correct for the following criteria. For a long position I want the Open to open within the bottom 10% of the low and a close within the top 10% of the High. For a short it's just reversed. I never got any hits using all stocks in a scan so that made me wonder about it. Thank

(H - L) > 0 AND O <= H - (.9(H - L)) AND C >= L + (.9(H - L) ) OR C <= H - (.9(H - L)) AND O >= L + (.9(H - L)) AND (H - L) > 0
Craig_S
Posted : Tuesday, March 22, 2005 4:09:51 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
There are syntax issues with the PCF above.

I think you will find these PCFs more accurate and flexible. Each should be entered on their own and then combined in EasyScan as you like.

Open as % of range

(O-L)/(H-L)*100

This will return what percent of the daily range the open falls on. 50 means the open is 50% of the range (half-way between the high and low). 100 means the open is at the high. 75 means the open is at 75% of the range (top quarter of the daily bar).

Put it in an EasyScan and set the VALUE range to whatever you desire. You can use it again in another scan for your shorts, etc.

Close as % of range

(C-L)/(H-L)*100

This will return what percent of the daily range the close falls on.

With these two PCFs you should have no trouble finding what you want. You can add this PCF as its own entity to be sure the stocks found had a range.

Has a Trading Range
(H-L)>0

Let me know how it works for you!

- Craig
Here to Help!
bustermu
Posted : Tuesday, March 22, 2005 6:05:19 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
The PCF;

((H-L)>0ANDO<=H-.9*(H-L)ANDC>=L+.9*(H - L))
OR(C<=H-.9*(H-L)ANDO>=L+.9*(H - L)AND(H-L)>0)

should give you what you want.

Notice that you need a "*" to multiply and your parentheses are not correct.

The most important thing to know is TC is unconventional in that it does OR's before AND's. Notice that parentheses were used to force the system to do the AND's first. This should be fixed in my opinion. But, as long as everyone knows it, it does no harm. It is just a convention like doing + before *. If they did * before + I do not believe anyone would use the system.

Thanks,
Jim Murphy
bustermu
Posted : Tuesday, March 22, 2005 6:14:54 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
Errata:

QUOTE (bustermu)
It is just a convention like doing + before *. If they did * before + I do not believe anyone would use the system.


should read:

It is just a convention like doing * before +. If they did + before *, I do not believe anyone would use the system.

Sorry,
Jim Murphy
marv73
Posted : Wednesday, March 23, 2005 10:31:47 PM
Gold Customer Gold Customer

Joined: 10/7/2004
Posts: 10
Craig
Thanks for your help. Works just fine. If you get a spare minute and looking for something to do can you tell me what was wrong with the one I hatched.
Thanks
Doug_H
Posted : Thursday, March 24, 2005 1:11:33 AM


Worden Trainer

Joined: 10/1/2004
Posts: 4,308
First, let me address what was wrong with your original PCF. When you do a function like (.9(H-L)), you must include the multiplication operator like this: (.9*(H-L)). Without it, the program was actually ignoring every instance of .9 in your formula (didn't know what to do with it). As a result, everything to the left of the OR was looking for stocks that opened at the low and closed at the high, and everything to the right of the OR was looking for stocks that opened at the high and closed at the low.

If that was the only problem, then your PCF should have returned True for any stock where either condition was true, but, due to some missing parens, the program was not executing the OR in the order you expected.

Here is the corrected version of the formula you wrote.

((H - L) > 0 AND O <=( H -(.9*(H - L))) AND C >=(L + (.9*(H - L))))
OR
(C <=(H - (.9*(H - L))) AND O >=(L + (.9*(H - L)))AND(H - L) > 0)


I added the multiplication operators, and I put the whole expression to the left of the OR in another set of parens, and the whole expression to the right of the OR in its own set of parens. That told the program to treat everything to the left of the OR as one complete condition, and everything to the right of the OR as another complete condition.

When tested in my TeleChart, it worked like a charm. For All Stocks, it found 795 stocks that either opened at or near the low and closed at or near the high, OR, Opened at or near the high and closed at or near the low.

In other words, with a few minor syntax corrections, your formula did exactly what you were hoping. Pat yourself on the back for that. Nothing wrong with your logic, whatsoever.

Now...why was Craig's solution perhaps a better one? Because it provides much more versatility. First, maybe there would be a time when you only wanted to look for one of the two conditions. By keeping your PCF's short, you are creating building blocks that can be used and mixed and matched any way you like, should you change what you want to look for.

Also, say you decided one day that you wanted to look for stocks with a .8 tolerance, rather than a .9 tolerance. You'd have to make a whole new PCF for that. By using Craig's PCF's that use division instead of boolean functions (> < = etc.), you could rank stocks according to how far from the high or low they opened or closed.

Here is a training video that might help explain this concept a little better:

Constructing more versatile and reusable Personal Criteria Formulas


- Doug
Teaching Online!
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.