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

Re: Condition is NOT true



PureBytes Links

Trading Reference Links

Phillip

A condition when true is equal to one, and you can test for that either in
an implied way or specifically.

For example let's take a simple condition ... enter it in the indicator
builder and apply it to a chart

cond1:=cum(1)=5;
cond1;

this will be true on bar 5 ie it will be equal to 1 on bar 5 and you will
see the indicator move from 0 to 1

                 /\                                  true      condition 1
________/  \______________     false

we can now test for this condition implicitly eg
if(cond1,value_if_true,value_if_false)
or test for it explicitly eg if(cond1=1,value_if_true,value_if_false)

by using the explicit test we can test for the NOT condition by testing for
the condition to be zero

ie if(cond1=0,value_if_cond1_is_not_true,value_if_cond1_is_true)

add the following to your test indicator

notcond1:=if(cond1=0,1,0);
-2+notcond1;

________    ____________________   true
                \  /                                                   NOT
condition 1
                 \/                                            false

this will plot the NOT cond1 (offset to a baseline of -2) and you will see
you have the desired result
ie the function is true (is equal to 1) for all conditions except when cond1
is true (on bar 5)

You can apply this principle to any condition no matter how complex. So
build the condition and then
to get the NOT condition, test for its value to be zero.

Regards ... Martin




----- Original Message -----
From: "Philip" <pschmi02@xxxxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Thursday, March 09, 2000 12:58 PM
Subject: Condition is NOT true


> 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
>
>