Platinum Customer
Joined: 12/4/2016 Posts: 5
|
You were helping out Chris55 with some questions around having conditions return +1 and/or -1 values. My question is similar.
I understand that a Boolean condition will normally return +1 if true and 0 if not true. How do you write a formula that would return a -1 if true and a 0 if not true?
I have some bullish and bearish conditions that I want to combine in to an oscillator in histogram style so the +1 and -1 are necessary. Currently all the formulas return +1 or 0 and so the indicator never goes in to negative territory.
If conditions cannot return a -1 value, is it possible to have the boolean formula multiplied by -1?
Thank you.
|
Worden Trainer
Joined: 10/7/2004 Posts: 65,138
|
If you put a Boolean formula inside parentheses as part of a formula designed to return a numeric value it returns -1 if true and 0 if false.
If you put a Boolean formula inside an ABS() function as part of a formula designed to return a numeric value it returns 1 if true and 0 if false.
You can use the IIF() function to get a Boolean formula to return any numeric value you want when true or false.
-Bruce Personal Criteria Formulas TC2000 Support Articles
|