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

Re: [amibroker] For loop



PureBytes Links

Trading Reference Links




Bill,
 
For loop is extremely flexible. 

for ( init-expression ; cond-expression 
; loop-expression ) statement 
loopexpression can be ANY kind of expression you wish.
You can not only produce regular series
for( i = 0; i < BarCount; i = i + 3 )  // increment by 3 
every iteration
but you can also produce exponential series:
for( i = 1; i < BarCount; i = i * 2 ) // produces series of 
1, 2, 4, 8, 16, 32, 64, 128, 256, ... 
Best regards,Tomasz Janeczkoamibroker.com
<BLOCKQUOTE 
>
  ----- Original Message ----- 
  <DIV 
  >From: 
  wavemechanic 
  
  To: <A title=amibroker@xxxxxxxxxxxxxxx 
  href="">amibroker@xxxxxxxxxxxxxxx 
  Sent: Wednesday, May 28, 2003 2:11 
  PM
  Subject: Re: [amibroker] For loop
  
  Tomasz:
   
  Thanks, but I was searching for a way to increment 
  one variable in defined steps other than 1, rather than two variables.  I 
  think Walt and Herman, or my old fashion way of using an accumulator, will 
  work.
   
  Bill
  <BLOCKQUOTE 
  >
    ----- Original Message ----- 
    <DIV 
    >From: 
    Tomasz Janeczko 
    
    To: <A title=amibroker@xxxxxxxxxxxxxxx 
    href="">amibroker@xxxxxxxxxxxxxxx 
    Sent: Wednesday, May 28, 2003 3:38 
    AM
    Subject: Re: [amibroker] For loop
    
    Bill,
     
    You can increment as many variables as you 
    want.
    Example (useless but simple :-))
    
    for( i = <FONT color=#ff00ff 
    size=1>0, j = <FONT color=#ff00ff 
    size=1>0; i < BarCount; i++, j++ ){
       r<FONT 
    size=1>esult[j]=C[i]+V[j];
    }
    You can also nest loops:
    for( j = 0; j < 10 ; j++ )  for( k = 0; k < 
    BarCount; k++ )  { 
            result[ k ] 
    = j+result[k];  }
    Best regards,Tomasz Janeczkoamibroker.com
    <BLOCKQUOTE 
    >
      ----- Original Message ----- 
      <DIV 
      >From: 
      <A title=wd78@xxxxxxxxxxxx 
      href="">wavemechanic 
      To: <A 
      title=amibroker@xxxxxxxxxxxxxxx 
      href="">AmiBroker 
      Sent: Wednesday, May 28, 2003 1:32 
      AM
      Subject: [amibroker] For loop
      
      Does the FOR loop statement, which is normally 
      shown as for (xxx; yyy; zzz), permit the addition of another statement for 
      incrementing the variable xxx?  And if so, what is the 
      syntax?
       
      TIA
       
      BillSend BUG 
      REPORTS to <A 
      href="">bugs@xxxxxxxxxxxxxSend 
      SUGGESTIONS to <A 
      href="">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 
      Your use of Yahoo! Groups is subject to the <A 
      href="">Yahoo! Terms of Service. 
      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 
    Your use of Yahoo! Groups is subject to the <A 
    href="">Yahoo! Terms of Service. 
    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 
  Your use of Yahoo! Groups is subject to the <A 
  href="">Yahoo! Terms of Service. 







Yahoo! Groups Sponsor












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



Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.