PureBytes Links
Trading Reference Links
|
<FONT face=Arial color=#0000ff
size=2>Jason,
nasup
and nasdown return either a true or false result. If x>=ref(x,-1) then nasup
returns 1 if not it returns 0. The same is true for nasdown.so in your
code....
<FONT face=Arial color=#0000ff
size=2>
y= the
correlation of the close of !comp and 1.
<FONT face=Arial color=#0000ff
size=2>
I
assume what you are after is trying to find stocks that are highly correlated
with the index. You could do this with a simple correlation study as an
exploration
<FONT face=Arial color=#0000ff
size=2>
<FONT color=#282828
size=2>
x=Foreign<FONT
size=2>("!comp",<FONT
size=2>"Close"<FONT face=Arial
color=#0000ff size=2>);<FONT face=Arial
color=#0000ff size=2>
Filter<FONT
face=Arial>=<SPAN
class=253491904-22012004>1;<FONT
color=#282828>
AddColumn<FONT
face=Arial>(<FONT
color=#0000ff>Correlation(<FONT
color=#282828>x,C<FONT
color=#282828>,21<FONT
color=#282828>),<FONT
color=#ff00ff>"Correlation");<SPAN
class=253491904-22012004>//measures the correlation over the last 21 bars,
adjust as needed
<FONT face=Arial color=#282828
size=2>Run the exploration for n=1 bar then click the correlation header to
sort. This will show you how well the individual stock correlates to the index.
You could plot the same data by adding
<FONT
face=Arial>x=Foreign<FONT
size=2>("!comp",<FONT
size=2>"Close"<FONT face=Arial
color=#0000ff size=2>);
Plot<FONT color=#282828
size=2>(Correlation<FONT color=#282828
size=2>(x,C<FONT
color=#282828 size=2>,21<FONT
color=#282828 size=2>),""<FONT
color=#282828 size=2>,4<FONT
color=#282828 size=2>,1<FONT
color=#282828 size=2>);
GraphXSpace<FONT
face=Arial>=<FONT
size=2>10<FONT face=Arial
color=#0000ff>;
Regards,
Jayson
<FONT face=Tahoma
size=2>-----Original Message-----From: Jason Hart
[mailto:jhart_1972@xxxxxxxxx]Sent: Wednesday, January 21, 2004 3:23
PMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker]
Correlation Studies
I was wondering if anyone has experimented with correlation studies of a
stock relative to an index on a day when the index is up and when the index is
down. Since I trade mostly Nasdaq stocks I'm trying to put
together an indicator that shows the correlation of a stock when the
Nasdaq is up and when the Nasdaq is down. I'm having quite a bit
of trouble since I haven't really used the IIF function and I'm not sure
if I need to create composites. I put this together so far but it is way
off base (I'm afraid it's too simplistic!) - what happens is both studies are
the complete inverse of each other.
x=Foreign(<FONT
color=#ff00ff size=1>"!comp",<FONT color=#ff00ff
size=1>"Close");
Nasup = x >= Ref<FONT
size=1>(x,-1);
Nasdown = x < Ref<FONT
size=1>(x,-1<FONT
size=1>);
IIf(x> <FONT color=#0000ff
size=1>Ref(x,-<FONT color=#ff00ff
size=1>1),Nasup,Nasdown);
y= Correlation<FONT
size=1>(Nasup,C,100<FONT
size=1>);
z=Correlation<FONT
size=1>(Nasdown,C,100<FONT
size=1>);
Plot(y,<FONT
color=#ff00ff size=1>"Nasdaq Up Correl",<FONT
color=#ff00ff size=1>3,<FONT color=#ff00ff
size=1>1,1<FONT
size=1>,1<FONT
size=1>);
Plot(z,"Nasdaq Down
Correl",4<FONT
size=1>,1,<FONT
color=#ff00ff size=1>1,<FONT color=#ff00ff
size=1>1);
Do you Yahoo!?Yahoo! Hotjobs: <A
href="">Enter
the "Signing Bonus" Sweepstakes Send BUG REPORTS to
bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page: <A
href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check
group FAQ at: <A
href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:<A
href="">http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:<A
href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html
Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
|