AND NOT operator on Ninja Trader script?!? - futures io
futures io

AND NOT operator on Ninja Trader script?!?

Discussion in NinjaTrader

      Top Posters
    1. looks_one bukkan with 1 posts (3 thanks)
    2. looks_two vgbouchet with 1 posts (0 thanks)
    3. looks_3 Big Mike with 1 posts (0 thanks)
    4. looks_4 Zondor with 1 posts (2 thanks)
    1. trending_up 3,219 views
    2. thumb_up 5 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments

Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

(If you already have an account, login at the top of the page)

Search this Thread

AND NOT operator on Ninja Trader script?!?

(login for full post details)
  #1 (permalink)
Buenos Aires
Posts: 3 since Jun 2011
Thanks: 0 given, 0 received

Hi everybody,

I was trying to build up an indicator but I'm looking for the "AND NOT" operator and I cannot find it.

I would like to say "&& NOT" but I cannot find it on NT. I found it on C# though....NOT is ! or ~.

It's actually presented on c# as logical negation: ! or bitwise complement: ~.

I tried with both symbols before and after "&&" and with or without space...Does not work.

Could you please tell me how can I write "AND NOT" on NT script?

Thank you very much in advance.



Reply With Quote

Journal Challenge April 2021 results (now extended!):
Competing for $1800 in prizes from Jigsaw
looks_oneMaking a Living with the Microsby sstheo
(107 thanks from 17 posts)
looks_twoSalao's Journalby Salao
(33 thanks from 8 posts)
looks_3Deetee’s DAX Trading Journal (time based)by Deetee
(28 thanks from 11 posts)
looks_4Learning to Profit - A journey in algorithms and optionsby Syntax
(14 thanks from 9 posts)
looks_5Maybe a little bit different journalby Malykubo
(9 thanks from 8 posts)
Best Threads (Most Thanked)
in the last 7 days on futures io
Would You Sell Your System?
73 thanks
The Crude Dude Oil Trading System
44 thanks
Big Mike in Ecuador
42 thanks
The New Micro Contract - MICRO BITCOIN coming May 2021
25 thanks
futures io site changelog and issues/problem reporting
24 thanks
(login for full post details)
  #2 (permalink)
Calcutta, India
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks: 161 given, 269 received


not = !


if (x != y)
//do something

you are probably looking for
if (a == b && x != y)
//do something

Reply With Quote
The following 3 users say Thank You to bukkan for this post:
(login for full post details)
  #3 (permalink)
Portland Oregon, United States
Experience: Beginner
Platform: Ninjatrader®
Broker: CQG, Kinetick
Trading: Gameplay Klownbine® Trading of Globex
Zondor's Avatar
Posts: 1,347 since Jul 2009
Thanks: 1,245 given, 2,721 received

To negate a condition enclose the condition in parentheses and precede it with the exclamation point, !

Putting that after the double ampersand gives the AND NOT operator.

If a is greater than 12 and a is not greater than 25
---> if a is greater than 12 AND NOT (a is greater than 25)


if(  (a>12)     &&      ! (a>25)  )
Putting the exclamation point after the || gives the OR NOT operator.

if a is greater than 12 or b is NOT less than 6
--> if a is greater than 12 OR NOT (b is less than 6)

if(  (a>12) ||  !(b<6)  )

Also, as in the previous example, the UNEQUAL TO operator is != .

In practice use the AND NOT and OR NOT conditions above for more complex tests that cannot be done with simple inequalties.

Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
The following 2 users say Thank You to Zondor for this post:
(login for full post details)
  #4 (permalink)
 Big Mike 
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
Experience: Advanced
Platform: Custom solution
Trading: Futures & Crypto
Big Mike's Avatar
Posts: 49,980 since Jun 2009
Thanks: 32,454 given, 98,212 received

Thread Moved

Moved to NinjaTrader Programming

When creating a new thread, note which subforum you are in. Here is a short list of suggestions:

- Topic: Anything to do with an Elite indicator -> Subforum: The Elite Circle
- Topic: Looking for an existing indicator, or how-to use an indicator -> Subforum: (the platform)
- Topic: Programmer needing help with non-Elite indicator -> Subforum: (the platform) - Programming
- Topic: Want an indicator created/modified -> Reply to "Want indicator created free" in Elite Circle
- Topic: Vendors (trading rooms, commercial indicators) -> Subforum: Vendors/Product Reviews
- Topic: Discussion of Forex or Currency trading -> Subforum: Forex and Currency Trading
- Topic: Journals of your trading -> Subforum: Trading Journals or Elite Trading Journals
- Topic: General trading related discussions -> Subforum: Traders Hideout
- Topic: Discussion of a trading method -> Subforum: Traders Hideout
- Topic: Automated Trading -> Subforum: Elite Automated Trading

Last, any Elite Member may create more or less any of these topics in The Elite Circle at your own discretion (your support is appreciated).

This is just a short general list and doesn't cover everything. If you are unsure where to create your new thread, just create it in Traders Hideout and a moderator will move it if necessary.

-- Big Mike Trading

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:

Visit other sites? Please spread the word about your experience with our community!
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote

futures io Trading Community Platforms and Indicators NinjaTrader > AND NOT operator on Ninja Trader script?!?

Last Updated on November 26, 2011

Upcoming Webinars and Events

NinjaTrader Indicator Challenge!


Journal Challenge w/$1,800 in prizes!


Seven Trading Mistakes Solved With Smart Trading Tools w/Brannigan Barrett

Elite only

Copyright © 2021 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432,
All information is for educational use only and is not investment advice.
There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
no new posts