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

MA comparison Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
egil
Posted : Saturday, August 7, 2010 12:33:38 PM
Registered User
Joined: 10/7/2004
Posts: 22
My chart is set up to display the following MA's: 8,20,50,200.  I would like to create a scan to determine when today's value of 3 of 4 of these MA's are within 1.5% of each other.  Maybe it would be simpler to drop the 200 MA and scan just for when the 8,20, 50 are within 1.5% of each other.  The 8, 20, and 50 are more likely to be that close to each other.

Any hints on how to go about this would be appreciated.

Ed
diceman
Posted : Saturday, August 7, 2010 12:54:17 PM
Registered User
Joined: 1/28/2005
Posts: 6,049
Are they simple or exp.?



Thanks
diceman
egil
Posted : Saturday, August 7, 2010 1:23:27 PM
Registered User
Joined: 10/7/2004
Posts: 22
Exp.

Ed
egil
Posted : Saturday, August 7, 2010 2:36:04 PM
Registered User
Joined: 10/7/2004
Posts: 22
Here is what I came up with, but it doesn't get it.

((XAVGC8 - XAVGC20) / XAVGC8 * 100 < 1.5 OR (XAVGC8 - XAVGC20) / XAVGC8 * 100 > 98.5) AND ((XAVGC8 - XAVGC50) / XAVGC8 * 100 < 1.5 OR (XAVGC8 - XAVGC50) / XAVGC8 * 100 > 98.5) AND ((XAVGC8 - XAVGC200) / XAVGC8 * 100 < 1.5 OR (XAVGC8 - XAVGC200) / XAVGC8 * 100 > 98.5) AND C > 15. AND AVGV > 5000.

Ed
diceman
Posted : Saturday, August 7, 2010 3:19:45 PM
Registered User
Joined: 1/28/2005
Posts: 6,049

There are 2 ways you can go.
This asks for the 8 and 50 to be within 1.5% of the 20:


XAVGC8<=XAVGC20*1.015ANDXAVGC8>=XAVGC20*.985AND
XAVGC50<=XAVGC20*1.015ANDXAVGC50>=XAVGC20*.985

Its a true/false value.

 

This one takes the difference of the 8 and 50 from the 20 and divides it by the 20:


((ABS(XAVGC8-XAVGC20)+ABS(XAVGC50-XAVGC20))/XAVGC20)*100


You can sort by this one.
The smaller the values the closer that averages. (look for the first positive value)

In the SP500 COF is the smallest distance, GENZ is the largest.


I like the second way better.


Thanks
diceman

 

 

 

egil
Posted : Saturday, August 7, 2010 7:48:21 PM
Registered User
Joined: 10/7/2004
Posts: 22
Thanks Diceman.

That helps!

Ed
bustermu
Posted : Sunday, August 8, 2010 7:19:06 AM
Registered User
Joined: 1/1/2005
Posts: 2,645
Ed,

A sequence of positive numbers ( a1, a2, ..., aK ) are all within 1.5% of each other if and only if the maximum of the numbers is within 1.5% of the minimum of the numbers, i.e.,

max( a1, a2, ..., aK )/min( a1, a2, ..., aK ) <= 1.015

Using the formulas for the maximum and mimimum of three numbers at:

Min Max PCFs

we obtain:

(XAVGC8+XAVGC20+ABS(XAVGC8-XAVGC20)+2*XAVGC50
+ABS(XAVGC8+XAVGC20+ABS(XAVGC8-XAVGC20)-2*XAVGC50))
/ (XAVGC8+XAVGC20-ABS(XAVGC8-XAVGC20)+2*XAVGC50
-ABS(XAVGC8+XAVGC20-ABS(XAVGC8-XAVGC20)-2*XAVGC50))
<= 1.015 

as the desired PCF.

Thanks,
Jim Murphy
egil
Posted : Sunday, August 8, 2010 5:49:21 PM
Registered User
Joined: 10/7/2004
Posts: 22
Thanks, Jim

That is an ELEGANT solution!  Now I think I will expand it to include the 200 MA and scan for when 3 of 4 are within 1.5%.

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