PureBytes Links
Trading Reference Links
|
<FONT face=Arial color=#0000ff
size=2>Hello,
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>The Exploration below will generate a complete correlation table for
the N100.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>The leftmost column refers to the stock by number, since we do not have
string arrays in afl. You can add more colors to make this a heat map that shows
you instantly where pos/neg correlation exist. You can also use the Osaka plugin
to create csv exports for further analysis in Excel. The second piece of code is
an include file; copy it to your Include directory before running the
Exploration.
<FONT face=Arial color=#0000ff
size=2>
<FONT face=Arial color=#0000ff
size=2>herman
//
Exploration N100 Correlation table<FONT
color=#000000> Buy<FONT
color=#000000>=Sell<FONT
color=#000000>=Short<FONT
color=#000000>=Cover<FONT
color=#000000>=0<FONT
size=2>; StkNum = <FONT
color=#0000ff>Status(<FONT
color=#ff00ff>"StockNum"<FONT
color=#000000>); Filter<FONT
color=#000000> = Status<FONT
color=#000000>("LastBarInTest"<FONT
color=#000000>) AND StkNum
< 50<FONT
face=Arial>; <FONT
color=#0000ff>AddColumn(StkNum,<FONT
color=#ff00ff>" ",<FONT
color=#ff00ff>1.0<FONT
color=#000000>); n = StkNum; <FONT
color=#ff0000>#include<FONT
color=#000000> <NtoN100Ticker.afl> Ticker1 = Ticker; C1 =
Foreign<FONT
color=#000000>(Ticker1,"C"<FONT
size=2>);
for(m=<FONT
color=#ff00ff>50;m<=<FONT
color=#ff00ff>99<FONT
color=#000000>;m++) { n=m;
<FONT
color=#ff0000>#include<FONT
color=#000000> <NtoN100Ticker.afl> Ticker2 = Ticker;
C2 = Foreign<FONT
color=#000000>(Ticker2,"C"<FONT
size=2>);
Corr = Correlation<FONT
color=#000000>(C1, C2, 8<FONT
size=2> ); Color =
IIf(Corr><FONT
color=#ff00ff>0,<FONT
color=#ff00ff>8,<FONT
color=#ff00ff>4); // Add
colors to make a heat map<FONT
face=Arial> <FONT
color=#0000ff>AddColumn(Corr,Ticker,<FONT
color=#ff00ff>1.3,<FONT
color=#ff00ff>1<FONT
color=#000000>,Color);
<FONT face="Courier New"
color=#000000><FONT face=Arial
size=2> }<SPAN
class=870081922-26112003>
// Include
file
Ticker
= WriteIf<FONT
color=#000000>(n==0 ,
"AAPL"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==1 ,
"ADBE"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==2 ,
"ADCT"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==3 ,
"ALTR"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==4 ,
"AMAT"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==5 ,
"AMGN"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==6 ,
"AMZN"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==7 ,
"APCC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==8 ,
"APOL"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==9 ,
"BBBY"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==10 ,
"BEAS"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==11 ,
"BIIB"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==12 ,
"BMET"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==13 ,
"BRCD"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==14 ,
"BRCM"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==15 ,
"CDWC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==16 ,
"CEPH"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==17 ,
"CHIR"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==18 ,
"CHKP"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==19 ,
"CHRW"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==20 ,
"CIEN"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==21 ,
"CMCSA"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==22 ,
"CMVT"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==23 ,
"COST"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==24 ,
"CPWR"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==25 ,
"CSCO"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==26 ,
"CTAS"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==27 ,
"CTXS"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==28 ,
"DELL"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==29 ,
"DISH"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==30 ,
"DLTR"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==31 ,
"EBAY"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==32 ,
"ERICY"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==33 ,
"ERTS"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==34 ,
"ESRX"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==35 ,
"EXPD"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==36 ,
"FAST"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==37 ,
"FHCC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==38 ,
"FISV"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==39 ,
"FLEX"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==40 ,
"GENZ"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==41 ,
"GILD"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==42 ,
"GNTX"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==43 ,
"HGSI"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==44 ,
"HSIC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==45 ,
"IACI"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==46 ,
"ICOS"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==47 ,
"INTC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==48 ,
"INTU"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==49 ,
"IVGN"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==50 ,
"JDSU"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==51 ,
"JNPR"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==52 ,
"KLAC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==53 ,
"LAMR"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==54 ,
"LLTC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==55 ,
"LNCR"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==56 ,
"MCHP"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==57 ,
"MEDI"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==58 ,
"MERQ"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==59 ,
"MLNM"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==60 ,
"MNST"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==61 ,
"MOLX"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==62 ,
"MSFT"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==63 ,
"MXIM"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==64 ,
"NTAP"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==65 ,
"NVDA"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==66 ,
"NVLS"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==67 ,
"NXTL"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==68 ,
"ORCL"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==69 ,
"PAYX"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==70 ,
"PCAR"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==71 ,
"PDCO"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==72 ,
"PETM"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==73 ,
"PIXR"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==74 ,
"PSFT"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==75 ,
"PTEN"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==76 ,
"QCOM"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==77 ,
"QLGC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==78 ,
"RFMD"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==79 ,
"ROST"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==80 ,
"RYAAY"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==81 ,
"SANM"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==82 ,
"SBUX"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==83 ,
"SEBL"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==84 ,
"SIAL"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==85 ,
"SNDK"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==86 ,
"SNPS"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==87 ,
"SPLS"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==88 ,
"SPOT"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==89 ,
"SSCC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==90 ,
"SUNW"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==91 ,
"SYMC"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==92 ,
"TEVA"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==93 ,
"TLAB"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==94 ,
"VRSN"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==95 ,
"VRTS"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==96 ,
"WFMI"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==97 ,
"XLNX"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==98 ,
"XRAY"<FONT
size=2>, WriteIf<FONT
color=#000000>(n==99 ,
"YHOO" , <FONT
color=#ff00ff>""
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
<SPAN
class=870081922-26112003> -----Original Message-----From:
dirk schreiber [mailto:tianatrading@xxxxxxxxx]Sent: November 27, 2003
2:03 AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker]
to TOMASZ: how to loop through a list of tickers ?
i'm a bit surprised to see that
noone is answering my call.
so may i ask you directly, tomasz,
if what i asked is possible and if you could indicate me the right way to code
this ??
thank you,
dirk
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
dirk
schreiber
To: <A title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Monday, November 24, 2003 12:14
PM
Subject: Re: [amibroker] how to loop
through a list of tickers ?
noone ???
i'll try again: as an example, is
it possible to calculate all correlations of the stocks constituting the
nasdaq100 in one scan?
my code below will explore
the correlations of IBM with the other 99 constituents of my
nasdaq100 watchlist. is there a way in afl to tell amibroker to first
calculate these correlations for one stock, then go to the next and do the
same there and so forth, so that i could find out the 10 highest
correlations within the nasdaq100 for example ??
i have tried many ideas but i am
stuck (haven't mastered the new loop formulas very well yet)
...
any help would be greatly
appreciated, maybe this procedure would interest other amibroker users as
well.
thanks in advance,
dirk
pair="IBM";
x=Foreign(pair,<FONT
color=#ff00ff>"C");
y=C;
xpc=ROC(x,<FONT
color=#ff00ff>1);
ypc=ROC(y,<FONT
color=#ff00ff>1);
Graph0=<FONT
color=#0000ff>Correlation(xpc,ypc,<FONT
color=#ff00ff>20);
Graph1=<FONT
color=#0000ff>Correlation(xpc,ypc,<FONT
color=#ff00ff>200);
Filter<FONT
face=Arial>=Graph0>0.7 AND
Graph1>0.5;<FONT
color=#0000ff>
AddColumn<FONT
face=Arial>(Graph0,<FONT
color=#ff00ff>"Cor20",<FONT
color=#ff00ff>1.2);<FONT
color=#0000ff>
AddColumn<FONT
face=Arial>(Graph1,<FONT
color=#ff00ff>"Cor200",<FONT
color=#ff00ff>1.2);<FONT
color=#0000ff>
AddColumn<FONT
face=Arial>(Graph0+Graph1,<FONT
color=#ff00ff>"total",<FONT
color=#ff00ff>1.2);
Buy<FONT
face=Arial>=0;<FONT
color=#000080>
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
dirk
schreiber
To: <A
title=amibroker@xxxxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Thursday, November 20, 2003
6:56 PM
Subject: [amibroker] how to loop
through a list of tickers ?
hello,
this is my first
post.
i have been working my way into
the ideas behind pair trading, reading the interesting posts by yuki a few
months ago and writing some code.
here is where i'm stuck: when i
calculate correlation, price ratio and other things like beta ratio it is
my understanding that when scanning my database i can only compare one
stock at a time with the rest of my universe. -- is it possible to
calculate all correlations between all stocks in one scan?? i know that
with big groups this would mean millions of calculations, but for a
group like the n100 this should be possible?
can this be done by some sort
of loop?
i searched the mailing list
archive and found only one hint by DT, talking about maybe using something
like Status("STOCKNUM") == 0 , but i could not
work that out ...
any help is
appreciated,
thanks in advance,
<FONT face=Arial color=#000080
size=2>dirk<FONT face=Arial
size=2>Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<FONT
face=Arial
size=2>http://groups.yahoo.com/group/amiquote/messages/)<FONT
face=Arial size=2>--------------------------------------------Check
group FAQ at: <A
href=""><FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT
face=Arial size=2> Your use of Yahoo! Groups is subject to the
Yahoo! Terms of
Service.
Do you Yahoo!?<A
href=""><FONT face=Arial
size=2>Protect your identity with Yahoo! Mail
AddressGuardSend
BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS to
suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<FONT
face=Arial
size=2>http://groups.yahoo.com/group/amiquote/messages/)<FONT
face=Arial size=2>--------------------------------------------Check
group FAQ at: <A
href=""><FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT
face=Arial size=2> Your use of Yahoo! Groups is subject to the
Yahoo! Terms of
Service.
Do you Yahoo!?<A
href=""><FONT face=Arial
size=2>Protect your identity with Yahoo! Mail
AddressGuard<FONT
face=Arial size=2>Send BUG REPORTS to bugs@xxxxxxxxxxxxxSend SUGGESTIONS
to suggest@xxxxxxxxxxxxx-----------------------------------------Post
AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx (Web page:
<FONT
face=Arial
size=2>http://groups.yahoo.com/group/amiquote/messages/)<FONT
face=Arial size=2>--------------------------------------------Check group
FAQ at: <A
href=""><FONT
face=Arial
size=2>http://groups.yahoo.com/group/amibroker/files/groupfaq.html<FONT
face=Arial size=2> Your use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
Do you Yahoo!?<A
href="">Protect
your identity with Yahoo! Mail
AddressGuard
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.
|