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

Re: Corrected Metastock Coding Question



PureBytes Links

Trading Reference Links

BL

If I understand you properly then this should work.  If a1 is greater than
a2 then a3 is equal to (a1-a2), otherwise a3 is equal to zero.

a1:=mov(C,10,S);
a2:=mov(C,20,S);
a3:=If(a1>a2,a1-a2,=0);

Roy


> I would like to use a conditional IF statement to assign an expression to
a
> variable.  I can calculate a value within the IF statement, but I need to
> know how to set the value to a variable name.
>
> Example:  This works
>
> a1:=mov(C,10,S);
> a2:=mov(C,20,S);
> If(a1>a2,a1-a2,0);
>
> but I would like to insert a variable, say "a3", into the IF statement,
> something like this
>
> a1:=mov(C,10,S);
> a2:=mov(C,20,S);
> If(a1>a2,a3:=a1-a2,a3:=0);
>
> which does not work.
>
> Thanks in advance for your help.
>
>
>