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

Re: Condition is NOT true



PureBytes Links

Trading Reference Links

Philip,

You can use binary logic.  Any True/False statement evaluates to 1 when
true and to 0 when false.  Assuming you define a rising trend as having
a value greater than the previous day, then:

Mov(C,21,E) > Ref(Mov(C,21,E),-1) would such a statement.

(ADX(13) > Ref(ADX(13),-1)) = 0 would test for the ADX not rising.

Note also that you can combine True/false statements mathematically:

(Mov(C,21,E) > Ref(Mov(C,21,E),-1)) * (ADX(13) > Ref(ADX(13),-1)) is the
same as an AND statement: it evaluates to true (1*1=1) only whan both
components are true, otherwise to 0.

(Mov(C,21,E) > Ref(Mov(C,21,E),-1)) + (ADX(13) > Ref(ADX(13),-1)) = 1
would be true when only one component is true, but false when neither or
both are true.

(Mov(C,21,E) > Ref(Mov(C,21,E),-1)) + (ADX(13) > Ref(ADX(13),-1)) >= 1
would be false only when both components are false.

Even a statement "If A then B, else C" can be written (A*B) + (1-A)*C.

HHP
==========================


Philip wrote:
> 
> When writing Metastock formula syntax, is there a way to specify that a
> condition should NOT obtain?
> 
> Examples:
> 
> EMA(21) is rising, but the ADX(13) ISN'T.
> 
> Such an such an oscillator is above (say) 80, but this other set of
> circumstances (expanding on it now) is NOT the case.
> 
> Or must I spell out which conditions I want the second element/elements to
> fulfill in terms of "true?"
> 
> Philip