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

Re: [amibroker] javascript - exception



PureBytes Links

Trading Reference Links

Unless you use [] to refer to individual array elements, AB will process entire array at once.
 
In this line:
 
priceUp = priceUp && c1 > Ref( C, curBar );
 
c1 and ref( c, cuBar ) are both arrays, so AB will automatically convert priceUp to an array so it can hold the results. We could probably suggest a workaround if you wanted to explain what you are trying to do.
 
Steve
----- Original Message ----
Sent: Sunday, December 04, 2005 11:59 PM
Subject: [amibroker] _javascript_ - exception

Can anyone tell me why I am getting an error with the code below:

...

priceUp = True;

c1 = C;

for ( i = 1; i <= N; i++ )

{

       curBar = i * -1;

       priceUp = priceUp && c1 > Ref( C, curBar );

 

       if ( !priceUp ) break;

       ...

}

            …

 

I am getting an error on the line in red above.  The error is

Condition in IF, WHILE, FOR statements has to be Numeric or Boolean type.  You can not use array here, please use [] (array subscript operator) to access array elements”

 

(BTW< the Edit->Copy Error message function in Formula Editor is not working for me,  is this a bug?)

 



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