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

Re: How Do I Code this in Metastock?



PureBytes Links

Trading Reference Links

a3:=(If(a1>a2,a3:=a1-a2,a3:=0));

Hope that works 

Happy New Year

Chris

In a message dated 12/29/2001 12:34:29 AM Eastern Standard Time, blee7@xxxxxxxxxxxxxx writes:
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(10,C,S);
a2:=mov(20,C,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(10,C,S);
a2:=mov(20,C,S);
If(a1>a2,a3:=a1-a2,a3:=0);

which does not work.

Thanks in advance for your help.