[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Correlation between sector and stocks within sector



PureBytes Links

Trading Reference Links

Jayson, are you referring to the RSC code ?

HB

--- In amibroker@xxxxxxxxxxxxxxx, "Jayson" <jcasavant@xxxx> wrote:
> Correlation can offer some interesting insight. Here is a study that
> compares a stock to its sector. The sector data is derived using the
> composite approach I posted a couple of days ago, which allows you 
to scroll
> through a group of stocks while automatically comparing the correct 
sector
> index. The High and low thresh holds are set to a default of .50 
and -.50
> but both are adjustable via Param(). The indicator also includes a
> commentary...
> 
> enjoy
> 
> Jayson
> 
> 
> 
> pds=Param("Correlation Periods",14,5,20);
> Highthresh=Param("High Thresh hold",.50,.10,.90,.05);
> Lowthresh=Param("Low Thresh hold", -.50,-.75,-.10,.05);
> symbol="~i"+SectorID(1);
> si=Foreign(symbol,"C");
> x=Correlation(si,C,pds);
> indexzone1=IIf(x<=Highthresh AND x>0,x,IIf(x>=lowthresh AND
> x<0,x,IIf(x>highthresh,highthresh,IIf(x<Lowthresh,Lowthresh,0))));
> zone1col= IIf(x > 0, colorSeaGreen,colorRed);
> 
> Plot(indexzone1,"",zone1col,2);
> Plot(x,"",IIf(x>0,colorBrightGreen,colorLightOrange),2);
> Plot(si,"Index",colorYellow,1|styleOwnScale);
> Plot(C,"Stock",colorWhite,1|styleThick|styleOwnScale);
> index=ROC(si,pds);
> stock=ROC(C,pds);
> Islope=LinRegSlope(index,20);
> sslope=LinRegSlope(stock,20);
> 
> Title=WriteIf(stock>index,"\n This Stock is currently out-
performing it's
> Sector" ,"\n This Stock is currently under performing it's
> Sector")+WriteIf(x>Highthresh, "\n The Stock has A Positive 
Correlation to
> the Index",WriteIf(x<Lowthresh,"\n The Stock has A Negative 
Correlation to
> the Index","\n The Stock has little OR no Correlation"));
> 
> WriteIf(x>Highthresh, " suggesting a High probability that the 
Price of the
> Stock will follow the Index",WriteIf(x<Lowthresh, " which suggests 
a High
> probability that Price will NOT follow the Index"," to the index"));
> 
> WriteIf(islope>0 AND sslope>0,"\n Currently both the index and the 
Stock are
> Rising",WriteIf(islope<0 AND sslope<0,"\n Currently both the Index 
and the
> Stock are falling","\n Currently the Index and Stock are moving in 
Opposite
> directions"))+"\n Price Slope"+WriteVal(sslope)+" Index
> Slope"+WriteVal(islope);
> 
> -----Original Message-----
> From: goldfreaz <goldfreaz@xxxx> [mailto:goldfreaz@x...]
> Sent: Thursday, February 27, 2003 8:39 AM
> To: amibroker@xxxxxxxxxxxxxxx
> Subject: [amibroker] Correlation between sector and stocks within 
sector
> 
> 
> Anyone looking at the correltation function?
> 
> Something like:
> 
> Chan=AMA((c-Ref(c,-1))/c,0.62);
> Schan=AMA(Foreign(sector,"C",1)/Foreign(sector,"V",1),0.62);
> Corr=AMA(Correlation(Chan,schan,32),0.38);
> 
> 
>       Yahoo! Groups Sponsor
>             ADVERTISEMENT
> 
> 
> 
> 
> Send BUG REPORTS to bugs@xxxx
> Send SUGGESTIONS to suggest@xxxx
> -----------------------------------------
> 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
> 
> Your use of Yahoo! Groups is subject to the 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 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/