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

Re: [amibroker] how to loop through a list of tickers ?



PureBytes Links

Trading Reference Links




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<FONT 
size=1>(pair,"C");
y=C;
xpc=ROC(x,<FONT 
color=#ff00ff size=1>1);
ypc=ROC(y,<FONT 
color=#ff00ff size=1>1);
Graph0=Correlation<FONT 
size=1>(xpc,ypc,20<FONT 
size=1>);
Graph1=Correlation<FONT 
size=1>(xpc,ypc,200<FONT 
size=1>);
Filter=Graph0<FONT 
size=1>>0.7 AND 
Graph1<FONT 
size=1>>0.5<FONT face=Verdana 
size=1>;
AddColumn(Graph<FONT 
face=Verdana size=1>0,<FONT color=#ff00ff 
size=1>"Cor20",<FONT color=#ff00ff 
size=1>1.2);<FONT 
color=#0000ff size=1>
AddColumn(Graph<FONT 
face=Verdana size=1>1,<FONT color=#ff00ff 
size=1>"Cor200",<FONT color=#ff00ff 
size=1>1.2);<FONT 
color=#0000ff size=1>
AddColumn(Graph<FONT 
face=Verdana size=1>0+Graph<FONT face=Verdana 
size=1>1,<FONT color=#ff00ff 
size=1>"total",<FONT color=#ff00ff 
size=1>1.2);
Buy=0<FONT 
size=1>;
 
 
<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=Verdana color=#000080 
size=2>dirkSend 
  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. 

  
  
  Do you Yahoo!?Protect 
  your identity with Yahoo! Mail AddressGuard






Yahoo! Groups Sponsor












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.




Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard