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

Re: [amibroker] I keep getting error 6; How do variables be numeric and not an array???



PureBytes Links

Trading Reference Links

Hello,

First thing you should read is the "Understanding AFL" chapter of the user's guide:

http://www.amibroker.com/guide/h_understandafl.html

and then common coding mistakes:
http://www.amibroker.com/guide/a_mistakes.html


That explains what kind of mistake you are doing.

Specifically entire function you have written can be expressed using one line
of array - based code:

NoJumpingUp = Sum( GapUp(), Lookback ) == 0; 

This gives 1 (true) if there was zero gap-ups during last Lookback days.


Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message ----- 
From: "bestbobleonard" <bestbobleonard@xxxxxxxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Saturday, September 02, 2006 9:07 PM
Subject: [amibroker] I keep getting error 6; How do variables be numeric and not an array???


> 
> I'm trying to do a small function (see below) and keep getting an 
> error message which
> I can't solve via examples. 
> 
> I want to look back and check a number of  conditions which give bad 
> screenings. 
> There is only one in my problem below.
> 
> I get error 6 expression must be numeric or Boolean. I tried 
> different work arounds but
> Can't get it right.
> 
> I guess I would appreciate someone pointing out the error of my 
> ways. I put comments on the line that get an error message.
> 
> Thanks
> BobLenard
> 
> 
> 
> 
> function NoJumpingUp( lookback )
> // this program tests if a stock has made a significat jump. 
> // if it has made such a jump, the technical analysis is not valid.
> // daysback = howfar back to look for jumps
> // percnt = a percentage of Average True Range
> // ATRange = parameter of ATR function i.e. ATR(ATRange)
> // typically I use the values 15, 10 & 7 for the parameters
> 
> 
> { 
>  gotone = 0;
>  keyset = 0;
>  Lowtoday = 0;
>  Hiyesterday = 0;
>  Lookback = (-1) * abs(lookback);
> 
>  for( i = 0; i > Lookback; i-- )
>  {
>    k = i-1;
>    Lowtoday  =   Ref(Low,i);
>    Hiyesterday =  Ref(High,(i-1));     
> 
> //   if (    Ref(Low,i)  < Ref(High,k)  )  ///--- Does NOT WORK  
> 
>   if (    Lowtoday  < Hiyesterday  )  /// ALSO does not work!!!!!!!
>   { 
>    Null;
>   }
>  else
>   {
>     keyset = 1;
>   }
>  }
> 
> return keyset;
> }
> 
> 
> nojumpupt = nojumpingup(15);
> 
> 
> 
> Thanks,
> BobLenard
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 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
> 
> 
> 
> 
> 
> 
> 
> 
>