PureBytes Links
Trading Reference Links
|
Jayson,
I figured that part out, where I'm stuck is how to treat the cumulative results. If day 1 is true then what value is given to day one....then day 2 then day 3, etc? What I'm trying to do is construct two separate correlation studies - one compares the base stock to days when the Nasdaq is up and the other compares the base stock to the Nasdaq when the Nasdaq is down. I suspect they will be pretty jagged because there will be day when they do not budge because of false results - perhaps I'll have to use a MA on them.
The rationale behind this applies to sector/market laggards. They'll demonstrate a low correlation to the up days, since they are lagging, and if they have a high correlation to the Nasdaq on the Nasdaq down days that's a red flag - perhaps a sign to short the weak stocks
Thanks for the reply
Jason Jayson <jcasavant@xxxxxxxxxxx> wrote:
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....
y= the correlation of the close of !comp and 1.
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
x=Foreign("!comp","Close");
Filter=1;
AddColumn(Correlation(x,C,21),"Correlation");//measures the correlation over the last 21 bars, adjust as needed
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
x=Foreign("!comp","Close");
Plot(Correlation(x,C,21),"",4,1);
GraphXSpace=10;
Regards,
Jayson
-----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("!comp","Close");
Nasup = x >= Ref(x,-1);
Nasdown = x < Ref(x,-1);
IIf(x> Ref(x,-1),Nasup,Nasdown);
y= Correlation(Nasup,C,100);
z=Correlation(Nasdown,C,100);
Plot(y,"Nasdaq Up Correl",3,1,1,1);
Plot(z,"Nasdaq Down Correl",4,1,1,1);
Do you Yahoo!?Yahoo! Hotjobs: 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: 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. Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend 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.
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
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.
|