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

[amibroker] Re: Anyone able to access Amibroker AFL Library



PureBytes Links

Trading Reference Links




Herman,
 
You do not do worry about it or handle it by 
yourself.
AmiBroker does it for you.
 
for(bar=0; bar<barcount; bar++) { .... 
}
 
does not waste any cycles,
 
Try it:

 
array = 0;
for(bar=0; bar<barcount; bar++) 
{ 
  array[ bar ] = bar; 
}
Plot( array, "bar", colorRed );
Plot( BarIndex(), "barindex", colorBlue 
);
 
This  because array item 0 already is the 
first bar used by quick AFL (not the first bar in your data set)
and (barcount-1) is a last array item of 
quickafl (not the last bar in your data set).
I have mentioned it that barcount is a number of 
bars (items) in the array which may be smaller.
 

<TABLE  cellSpacing=0 
cellPadding=0 width=529 border=0 x:str>
  
  
    <TD class=xl24 
     
    width=97 height=17>Bar Index
    <TD class=xl24 
     
    align=right width=32 x:num>0
    <TD class=xl24 
     
    align=right width=28 x:num>1
    <TD class=xl24 
     
    align=right width=31 x:num>2
    <TD class=xl24 
     
    align=right width=28 x:num>3
    <TD class=xl24 
     
    align=right width=30 x:num>4
    <TD class=xl24 
     
    align=right width=32 x:num>5
    <TD class=xl24 
     
    align=right width=29 x:num>6
    <TD class=xl24 
     
    align=right width=37 x:num>7
    <TD class=xl26 
     
    align=right width=36 x:num>8
    <TD class=xl24 
     
    align=right width=35 x:num>9
    <TD class=xl24 
     
    align=right width=40 x:num>10
    <TD class=xl24 
     
    align=right width=32 x:num>11
    <TD class=xl24 
     
    align=right width=42 x:num>12
  
    <TD class=xl25 
     
    height=17>Array element
    <TD 
    ><FONT 
      face="Arial CE" size=2>
    <TD 
    ><FONT 
      face="Arial CE" size=2>
    <TD 
    ><FONT 
      face="Arial CE" size=2>
    <TD 
    ><FONT 
      face="Arial CE" size=2>
    <TD class=xl25 
     
    align=right x:num>0
    <TD class=xl25 
     
    align=right x:num>1
    <TD class=xl25 
     
    align=right x:num>2
    <TD class=xl25 
     
    align=right x:num>3
    <TD class=xl26 
     
    align=right x:num>4
    <TD class=xl25 
     
    align=right x:num>5
    <TD 
    >
    <TD 
    >
    <TD 
    >
 
As you can see in the picture above when QuickAFL 
is on, BarCount variable will give you 6 in that case
(the number of items in the array). So if you will 
iterate from 0 to 5 you will access only visible
items automatically.
 <FONT face=Arial 
size=2>
So writing 
for(bar=0; bar<barcount; bar++)  you are already accessing only 
what is necessary, not more.
 
Please note that the very first exectution after 
clicking "APPLY" in Indicator Builder uses always *ALL* bars 
because
it needs to analyse your code and its requirements. 
Only subsequent executions use QuickAFL (less bars).

Best regards,Tomasz 
Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  Herman van den 
  Bergen 
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">AmiBroker YahooGroups 
  Sent: Sunday, July 25, 2004 2:38 AM
  Subject: [amibroker] Looping within 
  QuickAFL bounds
  
  <SPAN 
  class=437013000-25072004>Hello,
  <SPAN 
  class=437013000-25072004> 
  would anybody have 
  figured out how to restrict a loop to the same range as QuickAFL. Normally is 
  use loops like:
  
    for(bar=0; 
    bar<barcount; bar++) { .... }
  <SPAN 
  class=437013000-25072004> 
  However this is 
  wasting a lot of cycles, especially when working with about 100,000 minute 
  bars of which only the displayed segment (about 1% of the data) is 
  important. <SPAN 
  class=437013000-25072004>For use with QuickAFL ON, can anybody provide 
  the code to define:
  
    <SPAN 
    class=437013000-25072004>FirstBarUsedByQuickAFL =  
?
    <SPAN 
    class=437013000-25072004>LastBarUsedByQuickAFL =  
  ?
  <SPAN 
  class=437013000-25072004>so that I can make the loop like 
  so:
  
    <SPAN 
    class=437013000-25072004>for( bar = FirstBarUsedByQuickAFL; bar <= 
    LastBarUsedByQuickAFL; Bar++ ) { .... 
  }
  Many 
  thanks,
  <SPAN 
  class=437013000-25072004>herman.Check 
  AmiBroker web page at:<A 
  href="">http://www.amibroker.com/Check 
  group FAQ at: <A 
  href="">http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
  


Check AmiBroker web page at:
http://www.amibroker.com/

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.