Justin,
Thank you.
However, in "2 state" condition for instance, bc only returns "1" at the intersection point. However at that point other conditions have not been met yet. I want MetaStock to signal when all conditions first time met. For instance;
bc:=Cross(C,Mov(C,20,S)){buy signal condition};
sc:=Cross(Mov(C,20,S),C){sell signal condition};
trade:=If( bc=1, 1, If(sc=1, 0, PREV));
cross( trade= x, 0.5)
when(a>=b)
Now it is 05.08.2009 bar number 10: Close crosses over Mov(C,20,S) which means bc=1 however a is still below b so there is no signal produced.
Now it is 05.08.2009 bar number 11: Close is no longer crossing Mov(C,20,S) (Close is now above it) which means bc=0 and a is now above b (a>=b is true) so there is no signal produced.
Now it is 05.08.2009 bar number 12: Close is no longer crossing
Mov(C,20,S) (Close is now above it) which means bc=0 and a is still above b (a>=b is true) so there is no signal produced.
Now it is 05.08.2009 bar number 13: Close is no longer crossing
Mov(C,20,S) (Close is now above it) which means bc=0 and a is still above b (a>=b is true) so there is no signal produced.
If I convert the code into the following:
bc:=C>=Mov(C,20,S){buy signal condition};
sc:=Mov(C,20,S)>=C{sell signal condition};
trade:=If( bc=1, 1, If(sc=1, 0, PREV));
cross( trade= x, 0.5)
when(a>=b)
Now it is 05.08.2009 bar number 10: Close crosses over Mov(C,20,S)
which means bc=1 however a is still below b so there is no signal
produced.
Now it is 05.08.2009 bar number 11: Close is no longer crossing
Mov(C,20,S) (Close is now above it) which means bc=1 and a is now above
b (a>=b is true) so there is signal produced.
Now it is 05.08.2009 bar number 12: Close is no longer crossing
Mov(C,20,S) (Close is now above it) which means bc=1 and a is still above b (a>=b is true) so there is signal produced.
Now it is 05.08.2009 bar number 13: Close is no longer crossing
Mov(C,20,S) (Close is now above it) which means bc=1 and a is still above b (a>=b is true) so there is signal produced.
I want only the signal at the 11th bar to be produced and no more, it is time all the conditions are FIRST met. Isn't is possible?
P.S.:
1. Why 0.5 in the following?: cross( trade= x, 0.5)
2. I have read the PREV function in the manual, however, what is the following one referring to?: trade:=If( bc=1, 1, If(sc=1, 0, PREV));
3. Is there any sources about this programming language other than the official manual?
Thank you so much. I appreciate your help very much.