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

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



PureBytes Links

Trading Reference Links




<SPAN 
class=629595917-27022003>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...
<SPAN 
class=629595917-27022003> 
<SPAN 
class=629595917-27022003>enjoy
 
Jayson
 
 
 <FONT 
face=Arial>
pds=Param(<FONT 
size=2>"Correlation Periods",<FONT 
size=2>14,5<FONT 
size=2>,20<FONT color=#282828 
size=2>);<FONT 
face=Arial>
Highthresh=Param(<FONT 
size=2>"High Thresh hold"<FONT 
color=#0000ff face=Arial>,.50,.10,.90,.05);<FONT 
color=#0000ff>
Lowthresh=Param(<FONT 
size=2>"Low Thresh hold"<FONT 
color=#0000ff face=Arial>, -.50,-.75,-.10,.05);<FONT 
color=#0000ff>
symbol="~i"+<FONT 
size=2>SectorID(<FONT 
size=2>1<FONT color=#0000ff 
face=Arial>);
si=Foreign(symbol,<FONT 
size=2>"C"<FONT color=#0000ff 
face=Arial>);
x=Correlation(si,<FONT 
size=2>C<FONT color=#0000ff 
face=Arial>,pds);
indexzone1=IIf(x<=Highthresh 
AND<FONT 
face=Arial> x>0<FONT 
size=2>,x,IIf(x>=lowthresh 
AND<FONT 
face=Arial> x<0<FONT 
size=2>,x,IIf<FONT 
size=2>(x>highthresh,highthresh,IIf<FONT 
size=2>(x<Lowthresh,Lowthresh,0<FONT 
color=#282828 size=2>))));<FONT 
color=#0000ff>
zone1col= IIf(x > <FONT 
size=2>0, <FONT 
size=2>colorSeaGreen<FONT 
color=#0000ff face=Arial>,<FONT 
face=Arial>colorRed<FONT color=#282828 
size=2>);
 
Plot(indexzone1,<FONT 
color=#ff00ff size=2>"",zone1col,<FONT 
color=#ff00ff size=2>2<FONT 
face=Arial>);
Plot(x,<FONT color=#ff00ff 
size=2>"",<FONT color=#0000ff 
size=2>IIf(x><FONT color=#ff00ff 
size=2>0,<FONT color=#000000 
size=2>colorBrightGreen<FONT color=#282828 
size=2>,<FONT color=#000000 
size=2>colorLightOrange<FONT color=#282828 
size=2>),2<FONT color=#282828 
size=2>);<FONT color=#0000ff 
size=2>
Plot(si,<FONT color=#ff00ff 
size=2>"Index",<FONT color=#000000 
size=2>colorYellow<FONT color=#282828 
size=2>,1<FONT color=#282828 
size=2>|<FONT color=#000000 
size=2>styleOwnScale<FONT 
face=Arial>);
Plot(<FONT color=#000000 
size=2>C<FONT color=#282828 
size=2>,"Stock"<FONT color=#282828 
size=2>,colorWhite<FONT 
face=Arial>,<FONT color=#ff00ff 
size=2>1|<FONT color=#000000 
size=2>styleThick<FONT color=#282828 
size=2>|<FONT color=#000000 
size=2>styleOwnScale<FONT 
face=Arial>);
index=ROC<FONT color=#282828 
size=2>(si,pds);<FONT 
color=#0000ff>
stock=ROC(<FONT 
size=2>C<FONT color=#0000ff 
face=Arial>,pds);
Islope=LinRegSlope<FONT 
size=2>(index,20<FONT color=#282828 
size=2>);<FONT 
face=Arial>
sslope=LinRegSlope<FONT 
size=2>(stock,20<FONT color=#282828 
size=2>);
 <FONT 
color=#0000ff>
Title=WriteIf<FONT 
size=2>(stock>index,"\n This Stock is currently 
out-performing it's Sector" ,"\n This 
Stock is currently under performing it's Sector"<FONT 
size=2>)+WriteIf(x>Highthresh, 
"\n The Stock has A Positive Correlation to the 
Index",WriteIf<FONT 
size=2>(x<Lowthresh,"\n The Stock has A Negative 
Correlation to the Index","\n The Stock 
has little OR no Correlation"<FONT color=#282828 
size=2>));
 
WriteIf(x>Highthresh, <FONT 
color=#ff00ff size=2>" suggesting a High probability that the Price of the Stock 
will follow the Index",<FONT 
color=#0000ff size=2>WriteIf(x<Lowthresh, 
" which suggests a High probability that Price 
will NOT follow the Index",<FONT 
color=#ff00ff size=2>" to the index"<FONT color=#282828 
size=2>));
 
WriteIf(islope><FONT 
color=#ff00ff size=2>0 <FONT 
color=#000000 size=2>AND<FONT color=#282828 
size=2> sslope>0<FONT color=#282828 
size=2>,"\n Currently both the index and the 
Stock are Rising",<FONT color=#0000ff 
size=2>WriteIf(islope<<FONT 
color=#ff00ff size=2>0 <FONT 
color=#000000 size=2>AND<FONT color=#282828 
size=2> sslope<0<FONT color=#282828 
size=2>,"\n Currently both the Index and the 
Stock are falling",<FONT color=#ff00ff 
size=2>"\n Currently the Index and Stock are moving in Opposite 
directions"))+<FONT color=#ff00ff 
size=2>"\n Price Slope"+<FONT 
color=#0000ff size=2>WriteVal<FONT color=#282828 
size=2>(sslope)+" Index Slope"<FONT 
color=#282828 size=2>+WriteVal<FONT 
color=#282828 size=2>(islope);
 
<FONT face=Tahoma 
size=2>-----Original Message-----From: goldfreaz 
<goldfreaz@xxxxxxxxx> [mailto:goldfreaz@xxxxxxxxx]Sent: 
Thursday, February 27, 2003 8:39 AMTo: 
amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Correlation between 
sector and stocks within sectorAnyone 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);  
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 
Your use of Yahoo! Groups is subject to the <A 
href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor


  ADVERTISEMENT









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 the Yahoo! Terms of Service.