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

10, 20, AND 50 DAY MOVING AVERAGE WITHIN 2 % OF EACH OTHER FOR 25 DAYS Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
r7cama
Posted : Sunday, July 31, 2005 4:52:00 PM
Registered User
Joined: 12/2/2004
Posts: 18
I am haveing trouble writing PCFs and EZ Scan to find 10-20-50 DMA within 2% of each other for a period of 25 days. For example: IOM,OVRL, and COL between 06/29/05 and 07/29/05. I can get the relationship between each other for a specific day but not over the 25 day period.
Craig_S
Posted : Monday, August 1, 2005 12:38:07 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
You will have to do it for every day. Assuming the 10 and 50 must be in 2% of each other, you can focus just on them (the 20 will be right in there with them).

Your PCF will have to look like this:

(AVGC10/AVGC50*100)>=98 AND (AVGC10/AVGC50*100)<=102 AND (AVGC10.1/AVGC50.1*100)>=98 AND (AVGC10.1/AVGC50.1*100)<=102 AND (AVGC10.2/AVGC50.2*100)>=98 AND (AVGC10.2/AVGC50.2*100)<=102 AND...

Keep running it to .24

Another idea is to think what a stock must me doing in order for these averages to converge and stay converged for this long. The stock must be in a mean consolidation. Try sorting by this condition in ascending order and look at the charts:

(MAXH40-MINL40)/(AVGH40-AVGL40)*100



- Craig
Here to Help!
bustermu
Posted : Monday, August 1, 2005 6:03:07 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
r7cama and Craig,

"... 10-20-50 DMA within 2% of each other ..."

I suppose 100 and 102 are "within 2% of each other". Are 98 and 100 "within 2% of each other"?

Suppose a, b, and c are positive numbers. Are a, b, and c within 2% of each other if and only if:

100*(max(a,b,c)-min(a,b,c))/min(a,b,c) <= 2,

or, equivalently,

100*max(a,b,c)/min(a,b,c) <= 102?

Craig,

It seems to me you are assuming AVGC20 is between AVGC10 and AVGC50. The only constraint on AVGC20 is:

(1/2)*AVGC10 < AVGC20 <(5/2)*AVGC50.

For example, if AVGC10 = 100 and AVGC50 = 100, then the only constrait on AVGC20 is 50 < AVGC20 < 250.

Thanks,
Jim Murphy
Craig_S
Posted : Monday, August 1, 2005 8:11:10 AM


Worden Trainer

Joined: 10/1/2004
Posts: 18,819
I was not assuming that AVGC20 was between them.
QUOTE (me)
the 20 will be right in there with them

If the 10 and 50 are close the 20 won't be too far away. I was attempting to simplify the PCF.
QUOTE
100*max(a,b,c)/min(a,b,c) &lt;= 102

There is no doubt this is the ideal format. Translating this into PCF language then covering 25 days... a monster to say the least.

I think ultimately this is still the best solution. Instead of searching for the indicators reacting to price action, scanning for the price action is the simplest (but not sniper-rifle precise) method.
QUOTE (me)
Another idea is to think what a stock must me doing in order for these averages to converge and stay converged for this long. The stock must be in a mean consolidation. Try sorting by this condition in ascending order and look at the charts:
(MAXH40-MINL40)/(AVGH40-AVGL40)*100

(before you jump all over the 40-bar term... I know it is not exact)
My solutions will find the type of action he is looking for. I am also not a stickler for mega-precision when it comes to scanning for stock charts and my scanning solutions reveal that. You are welcome to post the PCF that looks for the MAX avg of the three to be no more than 2% higher than the MIN avg of the three for the past 25 days.

I would be curious how many stocks that actually trade would show up.

- Craig
Here to Help!
bustermu
Posted : Monday, August 1, 2005 9:33:45 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
QUOTE (Craig_S)
If the 10 and 50 are close the 20 won't be too far away.


If AVGC10 = AVGC50 = a, that is close but AVGC20 need only satisfy

0.5*a < AVGC20 < 2.5*a.

That is the nature of the infamous SMA. Most would probably consider anywhere near the endpoints quite far away.

From limited observations, AVGC20 appears to me to fall between AVGC10 and AVGC50 about 60% to 70% of the time. With this, my guess is that your PCF:

(AVGC10/AVGC50*100)>=98 AND (AVGC10/AVGC50*100)<=102

and a PCF for AVGC10, AVC20, and AVGC50 "within 2% of each other" agree well in excess of 95% of the time, but that is a guess. If one wishes to write the PCF (I do not), please see:

PCF for Order Statistics

for obtaining the maximum and minimum of three quantities.

Thanks,
Jim Murphy
bustermu
Posted : Monday, August 1, 2005 3:49:54 PM
Registered User
Joined: 1/1/2005
Posts: 2,645
Tests were run on the SP-500 Components WatchList updated through 07/29/05 using three different PCF's. The purpose was to determine those stocks for which AVGC10, AVGC20, and AVGC50 were within 2% of each other over the last 25 days.

1) A PCF for

max(AVGC10,AVGC20, AVGC50)
<= 1.02*min(AVGC10,AVGC20,AVGC50)

was written and run for the last 25 days as a Custom Percent True Indicator. Upon sorting by Actual Value, there were 28 whose value was 100.

2) Craig's PCF

(AVGC10/AVGC50*100)>=98 AND (AVGC10/AVGC50*100)<=102

was run exactly as above and all of the 28 above were detected plus 6 for a total of 34.

3) The WatchList was sorted with Craig's suggested PCF

(MAXH40-MINL40)/(AVGH40-AVGL40)*100

The first 10 contained 1 from Case 1).
The first 20 contained 4 from Case 1).
The first 50 contained 10 from Case 1).
The first 100 contained 17 from Case 1).
The first 200 contained 24 from Case 1).
The first 423 contained all 28 from Case 1).

The PCF used for Case 1) was

(((-1)*((AVGC10>AVGC20)+(AVGC10>AVGC50))<=2)
*((-1)*((AVGC10<AVGC20)+(AVGC10<AVGC50))<=0)*AVGC10
+((-1)*((AVGC20>AVGC10)+(AVGC20>AVGC50))<=2)
*((-1)*((AVGC20<AVGC10)+(AVGC20<AVGC50))<=0)*AVGC20
+((-1)*((AVGC50>AVGC10)+(AVGC50>AVGC20))<=2)
*((-1)*((AVGC50<AVGC10)+(AVGC50<AVGC20))<=0)*AVGC50)
/(((-1)*((AVGC10>AVGC20)+(AVGC10>AVGC50))<=2)
*((-1)*((AVGC10<AVGC20)+(AVGC10<AVGC50))<=0)
+((-1)*((AVGC20>AVGC10)+(AVGC20>AVGC50))<=2)
*((-1)*((AVGC20<AVGC10)+(AVGC20<AVGC50))<=0)
+((-1)*((AVGC50>AVGC10)+(AVGC50>AVGC20))<=2)
*((-1)*((AVGC50<AVGC10)+(AVGC50<AVGC20))<=0))
<=1.02*(((-1)*((AVGC10>AVGC20)+(AVGC10>AVGC50))<=0)
*((-1)*((AVGC10<AVGC20)+(AVGC10<AVGC50))<=2)*AVGC10
+((-1)*((AVGC20>AVGC10)+(AVGC20>AVGC50))<=0)
*((-1)*((AVGC20<AVGC10)+(AVGC20<AVGC50))<=2)*AVGC20
+((-1)*((AVGC50>AVGC10)+(AVGC50>AVGC20))<=0)
*((-1)*((AVGC50<AVGC10)+(AVGC50<AVGC20))<=2)*AVGC50)
/(((-1)*((AVGC10>AVGC20)+(AVGC10>AVGC50))<=0)
*((-1)*((AVGC10<AVGC20)+(AVGC10<AVGC50))<=2)
+((-1)*((AVGC20>AVGC10)+(AVGC20>AVGC50))<=0)
*((-1)*((AVGC20<AVGC10)+(AVGC20<AVGC50))<=2)
+((-1)*((AVGC50>AVGC10)+(AVGC50>AVGC20))<=0)
*((-1)*((AVGC50<AVGC10)+(AVGC50<AVGC20))<=2))

Thanks,
Jim Murphy
bustermu
Posted : Tuesday, August 2, 2005 7:14:52 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
Please note that Craig's approximate PCF for AVGC10, AVGC20, and AVGC50 within 2% of each other:

(AVGC10/AVGC50*100)>=98 AND (AVGC10/AVGC50*100)<=102

is more accurate if replaced by:

(AVGC10<=1.02*AVGC50)AND(AVGC50<=1.02*AVGC10)

and, in turn, is faster if replaced by:

(AVGC10<=1.02*AVGC50)*(AVGC50<=1.02*AVGC10) = 1

Similarlarly, a shorter and faster PCF for AVGC10, AVGC20, and AVGC50 within 2% of each other than the one I previously gave is:

(AVGC10<=1.02*AVGC20)*(AVGC10<=1.02*AVGC50)
*(AVGC20<=1.02*AVGC10)*(AVGC20<=1.02*AVGC50)
*(AVGC50<=1.02*AVGC10)*(AVGC50<=1.02*AVGC20) = 1

The shortest and fastest PCF for AVGC10, AVGC20, and AVGC50 within 2% of each other for the last 25 days is likely:

(AVGC10.0<=1.02*AVGC20.0)*(AVGC10.0<=1.02*AVGC50.0)
*(AVGC20.0<=1.02*AVGC10.0)*(AVGC20.0<=1.02*AVGC50.0)
*(AVGC50.0<=1.02*AVGC10.0)*(AVGC50.0<=1.02*AVGC20.0)
*(AVGC10.1<=1.02*AVGC20.1)*(AVGC10.1<=1.02*AVGC50.1)
*(AVGC20.1<=1.02*AVGC10.1)*(AVGC20.1<=1.02*AVGC50.1)
*(AVGC50.1<=1.02*AVGC10.1)*(AVGC50.1<=1.02*AVGC20.1)
*...
*(AVGC10.24<=1.02*AVGC20.24)*(AVGC10.24<=1.02*AVGC50.24)
*(AVGC20.24<=1.02*AVGC10.24)*(AVGC20.24<=1.02*AVGC50.24)
*(AVGC50.24<=1.02*AVGC10.24)*(AVGC50.24<=1.02*AVGC20.24)
= 1

Hopefully, TC2005 can multiply 150 of the -1's together and get the result 1.

Thanks,
Jim Murphy
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.