[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




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, "~Low 
Cap", "c/80"<FONT 
size=1>, 1+<FONT 
color=#ff00ff size=1>2+<FONT color=#ff00ff 
size=1>8+16<FONT 
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));
   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 
  
  
  Yahoo! Groups Links
  
    To visit your group on the web, go to:<A 
    href="">http://groups.yahoo.com/group/amibroker/  

    To unsubscribe from this group, send an email to:<A 
    href="">amibroker-unsubscribe@xxxxxxxxxxxxxxx  

    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
  


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.