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

Re: [amibroker] How to Program this More Efficiently



PureBytes Links

Trading Reference Links




Tomasz -
 
Thank you for the prompt reply, it works great, sort of.  
The problem is that it only creates the composite for the watch specified in the 
"define use filter" of the AA parameters.  The speed is, however, much 
improved.  
 
Any other good thoughts?  
 
Merry Christmas and a Happy & Prosperous New Year to you 
and your family.
 
lou howard
 
============================================
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Tomasz Janeczko 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Wednesday, December 24, 2003 3:45 
  PM
  Subject: Re: [amibroker] How to Program 
  this More Efficiently
  
  Lou,
   
  Instead of this loop use AddToComposite WITHOUT LOOP and 
  WITHOUT SETFOREIGN
  and use "Apply to" -> Filter instead. 
   
  This will be much faster.
   
  if( InWatchList(3) 
  )
  { 
  AddToComposite(C, <FONT color=#ff00ff 
  size=1>"~Low Cap", <FONT color=#ff00ff 
  size=1>"c/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);<FONT color=#0000ff 
  size=1>
  AddToComposite(O, <FONT color=#ff00ff 
  size=1>"~Low Cap", <FONT color=#ff00ff 
  size=1>"o/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);<FONT color=#0000ff 
  size=1>
  AddToComposite(H, <FONT color=#ff00ff 
  size=1>"~Low Cap", <FONT color=#ff00ff 
  size=1>"h/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);<FONT color=#0000ff 
  size=1>
  AddToComposite(L, <FONT color=#ff00ff 
  size=1>"~Low Cap", <FONT color=#ff00ff 
  size=1>"L/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);<FONT color=#0000ff 
  size=1>
  AddToComposite(V, <FONT color=#ff00ff 
  size=1>"~Low Cap", <FONT color=#ff00ff 
  size=1>"v/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);
  }
  if( InWatchList(5) 
  )
  { 
  
  AddToComposite(C, <FONT color=#ff00ff 
  size=1>"~High Cap", <FONT color=#ff00ff 
  size=1>"c/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);<FONT color=#0000ff 
  size=1>
  AddToComposite(O, <FONT color=#ff00ff 
  size=1>"~High Cap", <FONT color=#ff00ff 
  size=1>"o/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);<FONT color=#0000ff 
  size=1>
  AddToComposite(H, <FONT color=#ff00ff 
  size=1>"~High Cap", <FONT color=#ff00ff 
  size=1>"h/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);<FONT color=#0000ff 
  size=1>
  AddToComposite(L, <FONT color=#ff00ff 
  size=1>"~High Cap", <FONT color=#ff00ff 
  size=1>"L/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);<FONT color=#0000ff 
  size=1>
  AddToComposite(V, <FONT color=#ff00ff 
  size=1>"~High Cap", <FONT color=#ff00ff 
  size=1>"v/80", <FONT color=#ff00ff 
  size=1>1+2<FONT 
  size=1>+8+<FONT 
  color=#ff00ff size=1>16);
  }
   
  Best regards,Tomasz Janeczkoamibroker.com
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    Lou 
    H 
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">AmiBroker Group 
    Sent: Wednesday, December 24, 2003 6:04 
    PM
    Subject: [amibroker] How to Program 
    this More Efficiently
    
    The following code works but takes too long.  What I 
    want to do is make two composites each from a different watch list and each 
    list has about 80 symbols.  I want to run the code along with my one 
    minute scans for signals (the scans cover only one watch list and the 
    composites are not used for signals).  Is there a more efficient way to 
    code this?
     
    regards,
    lou howard
    =============================
    
    WLno=3;
    for( i = 
    0; ( sym=<FONT 
    color=#0000ff size=1>StrExtract(<FONT 
    color=#0000ff size=1>CategoryGetSymbols(
    categoryWatchlist, WLno)
    , i ) ) != ""; i++ 
    )
    {
    SetForeign<FONT 
    size=1>(sym);
    AddToComposite(C, <FONT color=#ff00ff 
    size=1>"~Low Cap", <FONT color=#ff00ff 
    size=1>"c/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);<FONT color=#0000ff 
    size=1>
    AddToComposite(O, <FONT color=#ff00ff 
    size=1>"~Low Cap", <FONT color=#ff00ff 
    size=1>"o/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);<FONT color=#0000ff 
    size=1>
    AddToComposite(H, <FONT color=#ff00ff 
    size=1>"~Low Cap", <FONT color=#ff00ff 
    size=1>"h/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);<FONT color=#0000ff 
    size=1>
    AddToComposite(L, <FONT color=#ff00ff 
    size=1>"~Low Cap", <FONT color=#ff00ff 
    size=1>"L/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);<FONT color=#0000ff 
    size=1>
    AddToComposite(V, <FONT color=#ff00ff 
    size=1>"~Low Cap", <FONT color=#ff00ff 
    size=1>"v/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);
    }
    WLno=5;
    for( i = 
    0; ( sym=<FONT 
    color=#0000ff size=1>StrExtract(<FONT 
    color=#0000ff size=1>CategoryGetSymbols(
    categoryWatchlist, WLno)
    , i ) ) != ""; i++ 
    )
    {
    SetForeign<FONT 
    size=1>(sym);
    AddToComposite(C, <FONT color=#ff00ff 
    size=1>"~High Cap", <FONT color=#ff00ff 
    size=1>"c/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);<FONT color=#0000ff 
    size=1>
    AddToComposite(O, <FONT color=#ff00ff 
    size=1>"~High Cap", <FONT color=#ff00ff 
    size=1>"o/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);<FONT color=#0000ff 
    size=1>
    AddToComposite(H, <FONT color=#ff00ff 
    size=1>"~High Cap", <FONT color=#ff00ff 
    size=1>"h/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);<FONT color=#0000ff 
    size=1>
    AddToComposite(L, <FONT color=#ff00ff 
    size=1>"~High Cap", <FONT color=#ff00ff 
    size=1>"L/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);<FONT color=#0000ff 
    size=1>
    AddToComposite(V, <FONT color=#ff00ff 
    size=1>"~High Cap", <FONT color=#ff00ff 
    size=1>"v/80", <FONT color=#ff00ff 
    size=1>1+2<FONT 
    size=1>+8+<FONT 
    color=#ff00ff size=1>16);
    }
     
    filter = 1;
    buy cross(ma(c, 20));
    sell cross(ma(c, 30));
    <FONT 
size=2> 


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





Yahoo! Groups Links
To visit your group on the web, go to:http://groups.yahoo.com/group/amibroker/ 
To unsubscribe from this group, send an email to:amibroker-unsubscribe@xxxxxxxxxxxxxxx 
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.