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

RE: [amibroker] how to? with script, download data from web



PureBytes Links

Trading Reference Links




You 
can easily check which is faster. Using some dummy parameters (I don't know 
yours), on a 2.133 GHz Athlon, this is what I get 
using DebugView:
<FONT face=Arial color=#0000ff 
size=2> 
<FONT 
color=#000000>was_buy=IIf<FONT 
color=#000000>(when_buy < when_sell AND data_buy==data_sell AND 
data="">1<FONT 
color=#000000>,0<FONT 
color=#000000>);                                    
//    337 
microSeconds
was_buy=IIf(<FONT 
color=#0000ff>BarsSince(Buy1) > <FONT 
color=#0000ff>BarsSince(Sell1) AND data_buy==data_sell AND 
data="" color=#ff00ff>1,<FONT 
color=#ff00ff>0);    // 4930 
microSeconds
 
<IMG alt="" hspace=0 
src="jpg00061.jpg" align=baseline border=0>
<FONT face=Arial color=#0000ff 
size=2> 
This 
shows that if your programs execute slow and take minutes or 
even hours to complete you should try some code-optimizations, I 
couldn't do without DebugView anymore. I added a menu item in the Custom 
Tools menu in AB, that way it is only a click away.
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>herman.


 
<FONT face=Arial color=#0000ff 
size=2> 
<FONT face=Arial color=#0000ff 
size=2>//signals definitions (meaningless parameters used)DSU = 
MA(H,8);DSd = MA(L,8);
<FONT face=Arial color=#0000ff 
size=2>Buy1=Cross(H,DSu); CondS = Ref(Buy1,-3);Sell1=CondS; 
Short1=Cross(DSd,L); CondL = 
Ref(Short1,-3);Cover1=CondL;
 
<FONT face=Arial color=#0000ff 
size=2>//checks if signals happened same 
daydata="">data_buy=ValueWhen( Buy1, DayOfYear()); 
data_sell=ValueWhen( Sell1, DayOfYear()); data_short=ValueWhen( Short1, 
DayOfYear()); data_cover=ValueWhen( Cover1, 
DayOfYear());
 
<FONT face=Arial color=#0000ff 
size=2>//checks in what order (globaly) signals 
occuredwhen_buy=ValueWhen(Buy1,BarIndex());  
when_sell=ValueWhen(Sell1,BarIndex());  
when_short=ValueWhen(Short1,BarIndex()); 
when_cover=ValueWhen(Cover1,BarIndex()); 
 
// Ok, 
which one will be better/faster now - look below:_TRACE("# 
TP1");was_buy=IIf(when_buy < when_sell AND data_buy==data_sell AND 
data="">_TRACE("# TP2");was_buy=IIf(BarsSince(Buy1) > 
BarsSince(Sell1) AND data_buy==data_sell AND data="">_TRACE("# 
TP3"); 


 
-----Original Message-----From: gty182 
[mailto:gty182@xxxxxxxxxxxxxx]Sent: Sunday, May 16, 2004 7:16 
AMTo: amibroker@xxxxxxxxxxxxxxxSubject: [amibroker] Which 
is faster ?

  
  Hello,
  It's me again - i got this part of code :
  signals definitions
  Buy1=Cross<FONT 
  size=1>(H,DSu); Sell1=CondS; Short1=<FONT color=#0000ff 
  size=1>Cross(DSd,L); Cover1=CondL;
  
  

  
  checks if signals happened same day
  data="">DayOfYear<FONT 
  size=1>();
  data_buy=ValueWhen( 
  Buy1, DayOfYear()); 
  
  data_sell=<FONT color=#0000ff 
  size=1>ValueWhen( Sell1, <FONT color=#0000ff 
  size=1>DayOfYear()); 
  data_short=<FONT color=#0000ff 
  size=1>ValueWhen( Short1, <FONT color=#0000ff 
  size=1>DayOfYear()); 
  data_cover=<FONT color=#0000ff 
  size=1>ValueWhen( Cover1, <FONT color=#0000ff 
  size=1>DayOfYear());
  
  

  
  checks in what order (globaly) signals 
  occured
  when_buy=ValueWhen<FONT 
  size=1>(Buy1,BarIndex<FONT 
  size=1>());  
  when_sell=<FONT color=#0000ff 
  size=1>ValueWhen(Sell1,<FONT color=#0000ff 
  size=1>BarIndex());  
  when_short=<FONT color=#0000ff 
  size=1>ValueWhen(Short1,<FONT color=#0000ff 
  size=1>BarIndex()); 
  when_cover=<FONT color=#0000ff 
  size=1>ValueWhen(Cover1,<FONT color=#0000ff 
  size=1>BarIndex()); 
  
  

  
  Ok, which one will be better/faster now - look 
  below:
  was_buy=IIf(when_buy < 
  when_sell AND data_buy==data_sell AND data="" 
  color=#ff00ff>1,0);
  was_buy=IIf(<FONT 
  color=#0000ff>BarsSince(Buy1) > <FONT 
  color=#0000ff>BarsSince(Sell1) AND data_buy==data_sell 
  AND data="" color=#ff00ff>1,<FONT 
  color=#ff00ff>0);
  cause i think both statements work same way (i 
  think ;) )
  Or should I do it some other way ? (better 
  from performance point of view)
   
  gty
   
  <FONT face=Arial 
  size=2> 
  <FONT face=Arial 
  size=2> 
  <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: <A 
  href="">http://groups.yahoo.com/group/amiquote/messages/)--------------------------------------------Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


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 Sponsor


  ADVERTISEMENT 












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.






Attachment: Description: ""