Sometimes in loop code you need to initialize the entire array first, but I didn’t mention this since it was working for me. Also, you didn't say what the error message was.
   
  function IIR2( input, f0, f1, f2 )
  {
      Result = 0;
      result[ 0 ] = input[ 0
 ];
      result[ 1 ] = input[ 1 ];//<---- getting error
  etc…
  --
  Terry
   
  -----Original Message-----
From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] On Behalf Of goldwing01_1999
Sent: Monday, November 28, 2005 09:10
To: amibroker@xxxxxxxxxxxxxxx
Subject: [amibroker] Re: Help with old code from
 DT
   
  ok, thanks terry. 
  now i am lost for thoughts what could be the problem, i will down 
  grade i try again.
   
  --- In amibroker@xxxxxxxxxxxxxxx, "Terry" <MagicTH@xxxx> wrote:
  >
  > Still works. I thought maybe it wouldn't since you're only looking 
  at 1
  > bar and your function refers to more than one bar, but it runs.
  > 
  >  
  > 
  > 
  >
 
  > --
  > 
  > Terry
  > 
  > -----Original Message-----
  > From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
  On
  > Behalf Of l washington
  > Sent: Monday, November 28, 2005 08:00
  > To: amibroker@xxxxxxxxxxxxxxx
  > Subject: RE: [amibroker] Help with old code from DT
  > 
  >  
  > 
  > terry I just notice that you are set up for
 "current symbol and 
  from
  > date".
  > I'm thinking or hoping you can run the script setup with "all 
  symbols
  > and N last quotations=1
  > 
  > thanks in advance for the reply
  > 
  > Terry <MagicTH@xxxx> wrote:
  > 
  > Goldwing,
  > 
  >  
  > 
  > I have version 4.70.5. I get no errors running this code. Here's 
  the
  > output from Explore:
  > 
  >  
  > 
  > 
  > 
  > --
  > 
  > Terry
  > 
  >  
  > 
  > -----Original Message-----
  > From: amibroker@xxxxxxxxxxxxxxx [mailto:amibroker@xxxxxxxxxxxxxxx] 
  On
  > Behalf Of goldwing01_1999
  > Sent: Monday, November 28, 2005 04:40
  > To: amibroker@xxxxxxxxxxxxxxx
  > Subject: [amibroker] Help with old code from DT
  > 
  >  
  > 
  > function IIR2(
 input, f0, f1, f2 )
  > 
  > {
  > 
  >   result[ 0 ] = input[ 0 ];
  > 
  >   result[ 1 ] = input[ 1 ];//<---- getting error
  > 
  >   for( i = 2; i < BarCount; i++ )
  > 
  >   {
  > 
  >     result[ i ] = f0 * input[ i ] + 
  > 
  >     f1 * result[ i - 1 ] + 
  >
 
  >     f2 * result[ i - 2 ]; 
  > 
  >   }
  > 
  >   return result;
  > 
  > }
  >
 
  > C1=Foreign("^VIX","C");C1=C;
  > 
  > RED=IIR2( C1, 0.2, 1.4, -0.6 );
  > 
  > k=0.6;// Optimize("k",0.6,0.1,2,0.1);
  > 
  > LINE=IIR2(C1,0.2-0.01*K,1.4+0.01*K,-0.6);
  > 
  > Buy=Cross(LINE,RED);
  > 
  > Sell=Cross(RED,LINE);
  > 
  > E1=Equity(1,0);dd=40;MA1=MA(E1,dd);
  > 
  > tb=100*Cum(E1<MA(E1,dd))/Cum(1);
  > 
  > Filter=1;
  > 
  > AddColumn(E1,"E1");
  > 
  > AddColumn(tb,"tb %");
  > 
  >  
  > 
  >  
  > 
  >  
  > 
  >  
  > 
  >  
  > 
 
 >  
  > 
  > 
  >  
  > 
  > Please note that this group is for discussion between users only.
  > 
  >  
  > 
  > To get support from AmiBroker please send an e-mail directly to 
  > 
  > SUPPORT {at} amibroker.com
  > 
  >  
  > 
  > For other support
 material please check also:
  > 
  > http://www.amibroker.com/support.html
  > 
  >  
  > 
  >  
  > 
  > Yahoo! Groups
 Links
  > 
  >  
  > 
  >     http://groups.yahoo.com/group/amibroker/
  > 
  >  
  > 
  >     amibroker-unsubscribe@xxxxxxxxxxxxxxx
  > 
  >  
  > 
  >     http://docs.yahoo.com/info/terms/
  > 
  >  
  > 
  >  
  > 
  >  
  > 
  >   _____  
  > 
  > Yahoo!
  > 
  <http://pa.yahoo.com/*http:/us.rd.yahoo.com/evt=36035/*http:/music.ya
  hoo
  > .com/unlimited/>  Music Unlimited - Access over 1 million songs. 
  Try it
  > free. 
  > 
  > Please note that this group is for discussion between users only.
  > 
  > To get support from AmiBroker please send an e-mail directly to 
  > SUPPORT {at} amibroker.com
  > 
  > For other support material please check also:
  > http://www.amibroker.com/support.html
  > 
  >
 
  > 
  > 
  > 
  > 
  > SPONSORED LINKS 
  > 
  > 
  > Investment
  > <http://groups.yahoo.com/gads?
  t=ms&k=Investment+management+software&w1=I
  > 
  nvestment+management+software&w2=Real+estate+investment+software&w3=I
  nve
  > 
  stment+property+software&w4=Software+support&w5=Real+estate+investmen
  t+a
  > 
  nalysis+software&w6=Investment+software&c=6&s=200&.sig=_XXUzbE9l5lGlZ
  NcM
  > u4KNQ>  management software 
  > 
  > Real
  >
 <http://groups.yahoo.com/gads?
  t=ms&k=Real+estate+investment+software&w1=
  > 
  Investment+management+software&w2=Real+estate+investment+software&w3=
  Inv
  > 
  estment+property+software&w4=Software+support&w5=Real+estate+investme
  nt+
  > 
  analysis+software&w6=Investment+software&c=6&s=200&.sig=5_sgDczz3ArKG
  MtJ
  > 9tFSJA>  estate investment software 
  > 
  > Investment
  >
 <http://groups.yahoo.com/gads?
  t=ms&k=Investment+property+software&w1=Inv
  > 
  estment+management+software&w2=Real+estate+investment+software&w3=Inv
  est
  > 
  ment+property+software&w4=Software+support&w5=Real+estate+investment+
  ana
  > 
  lysis+software&w6=Investment+software&c=6&s=200&.sig=_N6zcwefgp4eg5n6
  oX5
  > WZw>  property software 
  > 
  > 
  > Software
  > <http://groups.yahoo.com/gads?
  t=ms&k=Software+support&w1=Investment+mana
  > 
  gement+software&w2=Real+estate+investment+software&w3=Investment+prop
  ert
  > 
  y+software&w4=Software+support&w5=Real+estate+investment+analysis+sof
  twa
  > re&w6=Investment+software&c=6&s=200&.sig=MJ2jP31F3n64RDZkDadU8w>
  > support 
  > 
  > Real
  > <http://groups.yahoo.com/gads?
  t=ms&k=Real+estate+investment+analysis+sof
  > 
  tware&w1=Investment+management+software&w2=Real+estate+investment+sof
  twa
  > 
  re&w3=Investment+property+software&w4=Software+support&w5=Real+estate
  +in
  > 
  vestment+analysis+software&w6=Investment+software&c=6&s=200&.sig=GmF8
  PlA
  > JASx0wrSaX5-Zlw>  estate investment analysis software 
  > 
  > Investment
  > <http://groups.yahoo.com/gads?
  t=ms&k=Investment+software&w1=Investment+m
  > 
  anagement+software&w2=Real+estate+investment+software&w3=Investment+p
  rop
  > 
  erty+software&w4=Software+support&w5=Real+estate+investment+analysis+
  sof
  > tware&w6=Investment+software&c=6&s=200&.sig=aMgGsKT4w29dMAYUzQUKzg>
  > software 
  > 
  >  
  > 
  >   _____  
  > 
  > YAHOO! GROUPS LINKS 
  > 
  >  
  > 
  > *          Visit your group "amibroker
  > <http://groups.yahoo.com/group/amibroker> " on the web.
  >   
  > 
  > *          To unsubscribe from this group, send an email to:
 
 >  amibroker-unsubscribe@xxxxxxxxxxxxxxx
  > <mailto:amibroker-unsubscribe@xxxxxxxxxxxxxxx?subject=Unsubscribe> 
  >   
  > 
  > *          Your use of Yahoo! Groups is subject to the Yahoo!
  > <http://docs.yahoo.com/info/terms/>  Terms of Service. 
  > 
  >  
  > 
  >   _____
  >
   
   
   
   
   
   
  ------------------------ Yahoo! Groups Sponsor --------------------~--> 
  Try Online Currency Trading with GFT. Free 50K Demo. Trade 
  24 Hours. Commission-Free. 
  http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
  --------------------------------------------------------------------~-> 
   
  Please note that this group is for discussion between users only.
   
  To get support from AmiBroker please send an e-mail directly to 
  SUPPORT {at} amibroker.com
   
  For other support material please check also:
  http://www.amibroker.com/support.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:
      http://docs.yahoo.com/info/terms/