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.
>
>
>