Try substituting [Max(0,i-1)] for [i-1].  The syntax checker doesn't look at 
your if/else logic, it just knows i-1 can be -1 and that's out of range.

Regards,

Bob
  ----- Original Message ----- 
  From: Potato Soup 
  To: AmiBroker (Discussion List) 
  Sent: Sunday, November 15, 2009 8:54 AM
  Subject: Re: [amibroker] Subscript out of range




  Not sure what that array is that you're indexing into but many indicators 
don't have values for the first n number of bars since they require some n 
number to be processed before outputing a meaningful value. 


------------------------------------------------------------------------------

  From: "Markus Witzler" <[email protected]> 
  Date: Sun, 15 Nov 2009 15:39:04 +0100
  To: <[email protected]>
  Subject: [amibroker] Subscript out of range


  Hello, 

  it´s probably just flawed thinking on my part, but I don´t understand why I 
get "subscript out of range" when I use the following if/else in CBT code:

  if (i=0) 

  y=ATRexRounded[0];

  else 

  y=ATRexRounded[i-1]; 

  The code is embedded in a for loop, so all yalues for i=0, 1, ... barcount 
should be defined, right?

  for (i = 0; i < BarCount; i++) //

  {

  }

  Thanks

  Markus



  __________ Information from ESET Smart Security, version of virus signature 
database 4609 (20091115)__________

  The message was checked by ESET Smart Security.

  http://www.eset.com




  

Reply via email to