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

Re: [amibroker] Matrix Construction



PureBytes Links

Trading Reference Links




Ken,
 
Although it is possible to wrap Foreign inside for loop it is 
not recommended
performance-wise  because of the fact 
that exploration already iterates through all tickers.
 
Exploration in fact already provides exactly the 'matrix' of 
values - all bars for all tickers
but the output is not arranged into 'matrix' but just the 
list.
 
This in fact is the advantage because you can have multiple 
values (columns)
per each date-ticker pair, while 'matrix' gives you only one 
value.
 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Ken Close 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">AmiBroker List 
  Sent: Monday, April 14, 2003 12:14 
  PM
  Subject: [amibroker] Matrix 
  Construction
  
  Yesterday, Bruce 
  Robinson described an important feature of the Trade program, namely the 2-D 
  matrix arrangement that allows Dates down the rows and Tickers across the 
  columns.
  If you add the 
  concept that a single variable for each ticker and each date are on "sheets" 
  just like the worksheets in Excel, then do you not have the makings of a 
  structure that allows ranking of calculated variables on each date for each 
  ticker?<FONT 
  face=Verdana size=2>  And more, perhaps even portfolio 
  trading?
  I was about to try 
  this but am stuck on how to reference individual tickers with a subscript 
  within a For Loop<FONT 
  face=Verdana size=2>----is it even possible?
  Using an example from 
  the Readme
  ·<FONT 
  face="Courier New">      <SPAN 
  lang=en-us><SPAN 
  lang=en-us> /* a 
  sample low-level implementation of Profit-target stop in AFL: 
  */ 
  
    
      Buy = 
      Cross( MACD(), Signal() );<SPAN 
      lang=en-us>
      <FONT face="Courier New" 
      size=2>priceatbuy=0;<SPAN 
      lang=en-us>
      for( i = 0; 
      i < BarCount; i++ )<SPAN 
      lang=en-us><FONT 
      face="Courier New" size=2>{<SPAN 
      lang=en-us><FONT 
      face="Courier New" size=2>     if( priceatbuy == 
      0 && Buy[ i ] )<SPAN 
      lang=en-us><FONT 
      face="Courier New" size=2>     priceatbuy = 
      BuyPrice[ i ];<SPAN 
      lang=en-us>
      <FONT face="Courier New" 
      size=2>     if( priceatbuy > 0 && 
      SellPrice[ i ] > 1.1 * priceatbuy )<SPAN 
      lang=en-us><SPAN 
      lang=en-us><FONT face="Courier New" 
      size=2>     {<SPAN 
      lang=en-us><SPAN 
      lang=en-us><FONT face="Courier New" 
      size=2>       Sell[ i ] = 
      1;<SPAN 
      lang=en-us><FONT face="Courier New" 
      size=2>       SellPrice[ i ] = 1.1 * 
      priceatbuy;<SPAN 
      lang=en-us><FONT 
      face="Courier New" 
      size=2>       priceatbuy = 
      0;<SPAN 
      lang=en-us><FONT face="Courier New" 
      size=2>     }<SPAN 
      lang=en-us><SPAN 
      lang=en-us><FONT face="Courier New" 
      size=2>     else<SPAN 
      lang=en-us><SPAN 
      lang=en-us><FONT face="Courier New" 
      size=2>       Sell[ i ] = 
      0;<SPAN 
      lang=en-us><FONT face="Courier New" 
      size=2>}<SPAN 
    lang=en-us>
  What is the Loop 
  command you would put "on top of"<SPAN 
  lang=en-us> or "around"<SPAN 
  lang=en-us> this code to 
  cycle thru the tickers? And how do you even make it pick a watchlist?  It 
  seems like it would use whatever watchlist you select as usual, but how to 
  reference and keep track of the tickers by date?
  <FONT face=Verdana 
  size=2>Comments?
  <FONT face=Verdana 
  size=2>Ken<SPAN 
  lang=en-us>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












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.