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

Re: [amibroker] Re: Quote sources (EOD providers)



PureBytes Links

Trading Reference Links




Thank 
you again, TJ. The learning process never ends with AB. Thanks to your help my 
code is running a few hundred times faster now... this means I can even add more 
frills :-) Sure proves it is worthwhile to, once code is working, work through 
it once more to try to optimize it.
<FONT face=Arial color=#0000ff 
size=2> 
Where 
else could one find this kind of technical support? I'll tell you: no where! it 
is unique!
<FONT face=Arial color=#0000ff 
size=2> 
best 
regards,
<FONT face=Arial color=#0000ff 
size=2>herman.
<FONT face=Arial color=#0000ff 
size=2> 

  <FONT face=Tahoma 
  size=2>-----Original Message-----From: Tomasz Janeczko 
  [mailto:amibroker@xxxxxx]Sent: Sunday, July 25, 2004 1:24 
  PMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: [amibroker] 
  Looping within QuickAFL boundsImportance: High
  Herman,
   
  It is because your formula calls LinearReg inside 
  loop so many times that requirements are added up so
  it effectively turns off QuickAFL at 
  all.
  Use instead this code:
   
  array = 0<FONT 
  face="Courier New">; T1 = <FONT 
  color=#0000ff>LinearReg(<FONT 
  color=#0000ff>LinearReg(<FONT 
  color=#000000>C,<FONT 
  color=#ff00ff>20),<FONT 
  color=#ff00ff>20); 
  for<FONT 
  color=#000000>(bar=0; 
  bar<BarCount<FONT 
  face="Courier New">; bar++) { LRR[bar] = T1[bar]; 
  array[ bar ] = bar; } bi=<FONT 
  color=#0000ff>BarIndex<FONT 
  color=#000000>(); Plot<FONT 
  color=#000000>( array, "bar"<FONT 
  color=#000000>, colorRed<FONT 
  face="Courier New"> ); <FONT 
  color=#0000ff>Plot( <FONT 
  color=#0000ff>BarIndex(), <FONT 
  color=#ff00ff>"QuickAFL start bar = "<FONT 
  color=#000000>+bi[0<FONT 
  color=#000000>]+" End bar = "<FONT 
  color=#000000>+bi[BarCount<FONT 
  color=#000000>-1] + 
  " NumBars =" + 
  BarCount, 
  colorBlue 
  ); 
   
  Loop-invariant part moved outside the loop 
  (basic programming principle)
  Best regards,Tomasz Janeczkoamibroker.com
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    Herman van den 
    Bergen 
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Sunday, July 25, 2004 5:48 
    PM
    Subject: RE: [amibroker] Looping within 
    QuickAFL bounds
    
    <FONT face=Arial color=#0000ff 
    size=2>TJ, i did NOT use Apply. I emailed test result emailed to you 
    privately for your persusal.
    <FONT face=Arial color=#0000ff 
    size=2> 
    <FONT face=Arial color=#0000ff 
    size=2>best regards,
    <FONT face=Arial color=#0000ff 
    size=2>herman.
    
      <FONT face=Tahoma 
      size=2>-----Original Message-----From: Tomasz Janeczko 
      [mailto:amibroker@xxxxxx]Sent: Sunday, July 25, 2004 10:11 
      AMTo: <A 
      href="">amibroker@xxxxxxxxxxxxxxxSubject: 
      Re: [amibroker] Looping within QuickAFL boundsImportance: 
      High
      Herman,
       
      The last sentence from my previous 
      e-mail should give you an answer:
      "Please note that the very <FONT 
      color=#800000>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@xxxxxxxxxxxxxxx 
        
        Sent: Sunday, July 25, 2004 1:38 
        PM
        Subject: RE: [amibroker] Looping 
        within QuickAFL bounds
        
        
          <FONT face=Arial color=#0000ff 
          size=2>Tomasz, I understand what you are saying.... But if I test the 
          code below using DebugView and i get 0.43 Second 
          execution regardless of wether I have QuickAFL 
          set On or OFF. So it appears that in this case QuickAFL does not 
          restrict my loops to its bounds...( i used AB 4.6, EOD data, max zoom 
          (10bars displayed)). Now if I set the loop to start at Barcount-40 to 
          cover only the data I think i should i get a dramatic improvement in 
          execution - which is what i want. <SPAN 
          class=406480511-25072004><FONT face=Arial color=#0000ff 
          size=2>What am i doing 
          wrong?
        
          <SPAN 
          class=406480511-25072004><FONT face=Arial color=#0000ff 
          size=2>h<SPAN 
          class=406480511-25072004>erman<SPAN 
          class=406480511-25072004><FONT 
          color=#0000ff>_TRACE(<FONT 
          color=#ff00ff>"#Start");array = 
          0<FONT 
          size=2>;<FONT 
          face="Lucida Console" color=#800000>for<FONT 
          size=2>(bar=<FONT 
          face="Lucida Console" color=#ff00ff>0<FONT 
          face="Lucida Console">; bar<BarCount; bar++) { 
          T1=LinearReg(<FONT 
          color=#0000ff>LinearReg(C,<FONT 
          color=#ff00ff>20),20); <FONT 
          size=2>// just to slow things down a 
          bitLRR[bar] = T1[bar];<FONT 
          face="Lucida Console">array[ bar ] = bar; }<FONT 
          face="Lucida Console" color=#0000ff>Plot<FONT 
          face="Lucida Console">( array, <FONT face="Lucida Console" 
          color=#ff00ff>"bar"<FONT 
          face="Lucida Console">, colorRed );<FONT 
          face="Lucida Console" color=#0000ff>Plot<FONT 
          face="Lucida Console">( <FONT face="Lucida Console" 
          color=#0000ff>BarIndex(), 
          <FONT face="Lucida Console" 
          color=#ff00ff>"barindex"<FONT 
          face="Lucida Console">, colorBlue );<FONT 
          color=#0000ff>_TRACE(<FONT 
          color=#ff00ff>"#End");
        
          <FONT 
          face=Tahoma><FONT 
          face=Arial color=#0000ff> 
          <FONT 
          face=Tahoma><SPAN 
          class=406480511-25072004> 
          <FONT 
          face=Tahoma><SPAN 
          class=406480511-25072004> -----Original 
          Message-----From: Tomasz Janeczko 
          [mailto:amibroker@xxxxxx]Sent: Sunday, July 25, 2004 3:40 
          AMTo: amibroker@xxxxxxxxxxxxxxxSubject: Re: 
          [amibroker] Looping within QuickAFL boundsImportance: 
          High
          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><FONT face="Arial CE" 
              size=2>0
              <TD class=xl24 
               
              align=right width=28 x:num><FONT face="Arial CE" 
              size=2>1
              <TD class=xl24 
               
              align=right width=31 x:num><FONT face="Arial CE" 
              size=2>2
              <TD class=xl24 
               
              align=right width=28 x:num><FONT face="Arial CE" 
              size=2>3
              <TD class=xl24 
               
              align=right width=30 x:num><FONT face="Arial CE" 
              size=2>4
              <TD class=xl24 
               
              align=right width=32 x:num><FONT face="Arial CE" 
              size=2>5
              <TD class=xl24 
               
              align=right width=29 x:num><FONT face="Arial CE" 
              size=2>6
              <TD class=xl24 
               
              align=right width=37 x:num><FONT face="Arial CE" 
              size=2>7
              <TD class=xl26 
               
              align=right width=36 x:num><FONT face="Arial CE" 
              size=2>8
              <TD class=xl24 
               
              align=right width=35 x:num><FONT face="Arial CE" 
              size=2>9
              <TD class=xl24 
               
              align=right width=40 x:num><FONT face="Arial CE" 
              size=2>10
              <TD class=xl24 
               
              align=right width=32 x:num><FONT face="Arial CE" 
              size=2>11
              <TD class=xl24 
               
              align=right width=42 x:num><FONT face="Arial CE" 
              size=2>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:
            
              <SPAN 
              class=437013000-25072004>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. <FONT face=Arial 
            size=2>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:<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:<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:<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:<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:<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.