Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

PCF for moving average test... Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
pacific
Posted : Friday, May 26, 2006 8:26:16 PM
Gold Customer Gold Customer

Joined: 3/22/2005
Posts: 17
I am trying to find stocks that have previously been below either their 20, 50 or 200 day moving averages and today have equaled or exceeded either of those moving averages. I created this scan...filtered it with all NYSE and NASDQ stocks of greater than 200,000 shares...included the PCF...and got no results...is this a correct pcf? Thank you very much..

((H < AVGC 50.1) AND (H >= AVGC 50)) OR ((H < AVGC 20.1) AND (H >= AVGC 20)) OR ((H < AVGC 200.1) AND (H >= AVGC 200))
diceman
Posted : Saturday, May 27, 2006 12:17:34 AM
Registered User
Joined: 1/28/2005
Posts: 6,049
pacific

Try:

((H1 < AVGC 50.1) AND (H >= AVGC 50)) OR ((H1 < AVGC 20.1) AND (H >= AVGC 20)) OR ((H1 < AVGC 200.1) AND (H >= AVGC 200))
---------------------------------------------------------------------
This is your PCF except it uses yesterdays H (H1) to test against yesterdays
moving average.

I don't believe today's high can be > then today's moving average and
yesterdays moving average at the same time.
(which is what you had)

That is why you had no hits.

Hope that helps
Good Luck




Craig_S
Posted : Saturday, May 27, 2006 5:55:59 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
Neither PCFs above will work.

Diceman, mind the spaces between AVGC and their terms.

Here is the needed PCF:

(H>=AVGC20 AND H1<AVGC20.1) OR (H>=AVGC50 AND H1<AVGC50.1) OR (H>=AVGC200 AND H1<AVGC200.1)

1,004 stocks returned TRUE for this yesterday.

- Craig
Here to Help!
diceman
Posted : Saturday, May 27, 2006 9:29:09 AM
Registered User
Joined: 1/28/2005
Posts: 6,049
Craig

I put pacifics PCF in a percent true indicator (copied from his post).

When I changed the Hs to H1s it gave me hits. (in the proper places on the
chart by my eyes) so I assumed it worked.

I copied the equation into my post reply.

The "spaces" were in his original post and not created by me.

I usually try and leave spaces out for that reason.

So the PCF "worked" I'm just not sure if the hits were the expected ones.

Thanks

diceman
Posted : Saturday, May 27, 2006 9:45:25 AM
Registered User
Joined: 1/28/2005
Posts: 6,049

Craig

I tried both side by side.

You are correct.

My PCF was giving hits but they were in the wrong places.

Too bad there is not a feature that says "syntax error".

Makes me feel better that I choose to leave spaces out.

Better safe then sorry.


Thanks
pacific
Posted : Saturday, May 27, 2006 9:57:39 AM
Gold Customer Gold Customer

Joined: 3/22/2005
Posts: 17
This is still not giving me what I am looking for...I am looking for a price bar...the high of which was below the 20 moving average yesterday (preferably for the last 5 days) and today the high reached or exceeded the moving average...it finally touched it. I am looking for price that will reject the moving average once it gets there in subsequent days (I will determine this by putting it on a watchlist). If you can help me with the 20 moving average I will copy the syntax for the 50 and 200. The scans which I have been helped with dont visibly do this using the graphic 20 simple moving average placed on the charts. Thanks so much...
pacific
Posted : Saturday, May 27, 2006 11:30:03 AM
Gold Customer Gold Customer

Joined: 3/22/2005
Posts: 17
Regarding the prior post #8...I tried to write something that would give me a H above the 20 period m.a. today when price had not been above the 20 m.a. for the last 5 days...it is not yielding any results...something must be wrong with the script...sorry to belabor this...but still cant achieve the result that I want...as outlined in the post above...thanks for any help...
H >= AVGC20 AND H1 < AVGC20.1 AND H2 < AVGC20.2 AND H3 < AVGC20.3 AND H4 < AVGC20.4 AND H5 < AVGC.5
bustermu
Posted : Saturday, May 27, 2006 12:32:47 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
QUOTE (diceman)
I don't believe today's high can be &gt; then today's moving average and yesterdays moving average at the same time.


diceman,

There are no constraints whatever on the values of C and AVGC20 for the last 19 days. They can be any preassigned values. Please see:

A Property of Simple Moving Averages

In light of this, your statement seems strange and perhaps unintended.

Thanks,
Jim Murphy

Craig_S
Posted : Saturday, May 27, 2006 4:00:43 PM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
pacific,

This PCF does work:

(H>=AVGC20 AND H1<AVGC20.1) OR (H>=AVGC50 AND H1<AVGC50.1) OR (H>=AVGC200 AND H1<AVGC200.1)

Create and calculate it. Add it to an EasyScan and then give me any example tickers it finds that you feel don't meet conditions.

- Craig
Here to Help!
diceman
Posted : Sunday, May 28, 2006 2:02:27 AM
Registered User
Joined: 1/28/2005
Posts: 6,049
Quote:"diceman,

There are no constraints whatever on the values of C and AVGC20 for the last 19 days. They can be any preassigned values."

bustermu

I meant to say:"I don't believe today's high can be > then today's moving average and < yesterdays moving average at the same time."

You are correct. My statement was driven more by probability rather then possibility.
As we restrict a scan it can get to the point where it is so restrictive it scans zero.

If we look at : H>AVGC50ANDH<AVGC50.1

The moving average cant be moving up and have a true condition.
The moving average cant be flat and have a true condition.
The moving average must be going lower.
The zone for a true condition is roughly:
AVGC50+.01 and AVGC50.1-.01

The window will get smaller as the moving average period gets larger.

When you add up all these factors, I would guess there would about
a 90% reduction in the amount of hits. Compared to the more common
form:

H>AVGC50ANDH1<AVGC50.1

So while the first equation can happen, it is much less robust then
the second.

Thanks
bustermu
Posted : Sunday, May 28, 2006 5:25:14 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
pacific,

Your PCF:

H>=AVGC20 AND H1<AVGC20.1 AND H2<AVGC20.2 AND H3<AVGC20.3 AND H4<AVGC20.4 AND H5<AVGC.5

will always return False because of the last inequality:

H5<AVGC.5

It is not proper syntax. TC2005 interprets it as:

H5<AVGC1.5

which is equivalent to:

H5<C5

This, and, consequently, your PCF, will always return False.

Change your PCF to what you intended:

H>=AVGC20 AND H1<AVGC20.1 AND H2<AVGC20.2 AND H3<AVGC20.3 AND H4<AVGC20.4 AND H5<AVGC20.5

and it will perform exactly as you intended.

Thanks,
Jim Murphy
Craig_S
Posted : Sunday, May 28, 2006 5:41:12 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
Pacific,

Before you do anything, please try the last version I gave you above and see if it matches your plotted moving averages.

If you don't see either the high crossing the 20, 50 or 200 on every stock it finds

(H>=AVGC20 AND H1<AVGC20.1) OR (H>=AVGC50 AND H1<AVGC50.1) OR (H>=AVGC200 AND H1<AVGC200.1)

Please go through this checklist to see where the problem is. I need to confirm your moving averages are plotted correctly.

Things to check if your moving averages don't "seem right" or "seem to match"

- Craig
Here to Help!
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.