PureBytes Links
Trading Reference Links
|
Thanks for the tip on ROC Ace, that's a good idea. I'll give it a shot...
I came up with the formula below but the variables y1 and z1 are incorrect. At first glance it looks like it may work when you plot it, but the two results track too closely together when you start looking at multiple stocks. I need to figure out how to treat the results of the iif condition in a numerical format and as a running total. I've about had it for one day. Good night all
x = Foreign("!comp","close");
y = IIf(x> Ref(x,-1),1,0);
z=IIf(x< Ref(x,-1),1,0);
y1=Cum(y);
z1=Cum(z);
test = Correlation(y1,C,50);
test1 = Correlation(z1,C,50);
test2 = Correlation(x,C,50);
Plot(test,"Nasdaq Up",4,4);
Plot(test1,"Nasdaq Down",5,4);
Plot(test2, "Nasdaq 50",6,4);
acesheet <acesheet@xxxxxxxxx> wrote:
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" SweepstakesSend 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.
|