Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 11:54:58 +0000



How to negate a condition

View Count: 1956

[2014-08-20 19:51:36]
User28286 - Posts: 24
Hello,

how do I form a condition, which is a negation, eg. if "NOT(C[-1]>O[-1])", then condition is True.
In NinjaScript one can use character "!" to negate the following condition - how to do it with SC when defining an Alert condition in a Study?

Thanks.
[2014-08-20 20:09:51]
Sierra Chart Engineering - Posts: 104368
Use:
C[-1] <= O[-1]
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
[2014-08-20 20:17:52]
User28286 - Posts: 24
Hmmm, it looks my example was way too simplistic. I didn't really mean what you thought you replied to, I meant specifically how to NEGATE a condition. What's SC's condition operator which is comparable to Ninjascript's "!" ??
[2014-08-20 20:25:16]
Sierra Chart Engineering - Posts: 104368
The formulas use the Excel formula syntax. So refer to the available information on the Internet for Microsoft Excel formulas.

Nothing comes to mind to do exactly something like what you show.

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2014-08-20 20:25:58
[2014-08-20 20:35:58]
Sawtooth - Posts: 4120
Here's the reference I use:
http://office.microsoft.com/en-us/excel-help/excel-functions-by-category-HP005204211.aspx
specifically:
http://office.microsoft.com/en-us/excel-help/not-HP005209196.aspx?CTT=5&origin=HP005204211

[2014-08-20 20:40:00]
Sierra Chart Engineering - Posts: 104368
Thank you for pointing out the NOT function:
http://office.microsoft.com/en-us/excel-help/not-HP005209196.aspx?CTT=5&origin=HP005204211

We had thought this function might have existed but we had not looked and what we were more thinking about was whether there was a not operator .

Although you could do something like this:
= (expression) = FALSE
Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing
Date Time Of Last Edit: 2014-08-20 20:42:58
[2014-08-20 20:48:45]
User28286 - Posts: 24
I just tried Excel's NOT operator, and it seems to work. The syntax is: NOT( logical_value ), and it simply returns the opposite of 'logical_value'. I can tell it's very useful in many cases where you want to define conditions where eg. "A and B and C, but NOT D". I recommend for you to verify it and add into the operator list in "Alert Condition Formula Format" in SC guide.
[2014-08-20 21:55:58]
Jeffrey - Posts: 2183
Use the "!" character, which is the logical not unary operator.

For example:
"!(C[-1]>O[-1])"

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account