PureBytes Links
Trading Reference Links
|
Jason,
I would think that what you need to do is simply a straight
correlation calculation of the ROC's or some boolean of ROC. If the
correlation coefficient is high (close to 1.0) then the stock moves
more or less in lockstep with the Nasdaq, if its very low then it
moves opposite to the Nasdaq.
A couple of ideas to try would be:
//-----------------------------------------------
x=Foreign("!comp","Close");
nazmoves=0;
nazmoves=iif(ROC(x,1)>0,1,iif(ROC(x,1)<0,-1);
stockmoves=0;
stockmoves=iif(ROC(C,1)>0,1,iif(ROC(C,1)<0,-1);
z=Correlation(nazmoves,stockmoves,100);
//-----------------------------------------------
OR
//-----------------------------------------------
x=Foreign("!comp","Close");
nazmoves=ROC(x,1);
stockmoves=ROC(C,1);
z=Correlation(nazmoves,stockmoves,100);
//-----------------------------------------------
I'm not sure of this, but I don't think the correlation coefficient
cares about the actual magnitude of the moves, just the direction.
-ace
--- In amibroker@xxxxxxxxxxxxxxx, Jason Hart <jhart_1972@xxxx> wrote:
> 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@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 Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/GHeqlB/TM
---------------------------------------------------------------------~->
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:
http://docs.yahoo.com/info/terms/
|