To find logical operators search on logic. The reserved boolean words are true and false.
Another way to get the discrete value of omc in an IF statement use if ( LastValue(omc)) Fcase = "b"; But this only works if you actually want the last value of an array. But you can also use LastValue(Ref(var, -n)); where var is the array and n is how many cells back you want to look. You don't need the parens in the statement Omc = (C0 > eh13) AND (Op0 < wbx150) AND (C0 < the75pzone) AND myind1 AND sup5up AND n17up ; This will give the same results Omc = C0 > eh13 AND Op0 < wbx150 AND C0 < the75pzone AND myind1 AND sup5up AND n17up ; You would only need the parens if the first three were ORed and then ANDed with the last three. if you want to write values in Exploration columns use writeif(omc, "b", "a"); That will do the logic for you without having to use array manipulation. if omc is actually a filter and you only want columns written where this is true try Filter = omc; Barry --- In [email protected], "Howard B" <[EMAIL PROTECTED]> wrote: > > Hi Best -- > > There are two AFL operators that look alike but are very different - - IF > and IIF. > > //--------------------------------- > > IIF is a function. Its syntax is IIF(boolean, TruePart, FalsePart); and it > returns an array as a result; Typical use is as part of a regular AFL > program. For example > > UpDay = IIF(C>Ref(C,-1),C-Ref(C-1),0); > > Test to see if today's close is greater than yesterday's close. If it is, > return the change, if it is not, return 0. > > //---------------------------------- > > IF is a flow control statement, part of IF ... ELSE. The operand of IF must > be a scalar, not an array. IF is most often used within looping code, where > you are stepping through all of the data bars yourself. For example > for (i=1; i<BarCount; i++) > { > > // some other code > > IF(C[i] > C[i-1]) > { > UpDay[i] = C[i]-C[i-1]; > } > ELSE > { > UpDay[i] = 0; > } > > //------------------------------------ > > Thanks, > Howard > > > > > On Sun, Sep 14, 2008 at 6:06 PM, bestleonard <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > I keep getting error 6 with 'IF' statement. > > I have a long conditional like: > > > > Omc = (C0 > eh13) AND (Op0 < wbx150) AND (C0 < the75pzone) AND > > myind1 AND sup5up AND n17up ; > > > > (Then:) > > > > Fcase = "a"; > > > > if ( omc) Fcase = "b"; > > > > I keep getting error 6. > > > > I've changed the 'Boolean' expression to Ref(omc, 0) and > > If (omc > 0) and a few other variations. > > > > My filter is a bunch of `OR' statements and I want to, with an > > addtextcolum statement display which `OR' statement got through the > > filter statement. > > > > And I've searched the maual. The words 'and' and 'or' are not > > in the reserved word list, and I don't think boolean is defined, > > but I could be wrong. > > > > Thanks In advance for showing me the error of my ways. An example > > of how to do this would be great. Want I want is the iif with no > > action when the statement is false. > > > > > > >
