If statements are used primarily for checking individual points in an array as opposed to the entire array ...
Ref(Array, -1) is an array, NOT a single point in the array. Array[i] is a point in an array ... Your AFL can probably be written without a loop ... --- In [email protected], "bestbobleonard" <[EMAIL PROTECTED]> wrote: > > > 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 condition in my problem below. > > I get 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 <*> To visit your group on the web, go to: http://groups.yahoo.com/group/amibroker/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
