PureBytes Links
Trading Reference Links
|
How about A3:=If(A1>A2,A1-A2,0)
-Corey.
----- Original Message -----
From: "BL" <blee7@xxxxxxxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Friday, December 28, 2001 8:44 PM
Subject: Corrected Metastock Coding Question
> 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.
>
|