AND NOT operator on Ninja Trader script?!? - NinjaTrader Programming | futures trading

Go Back

> Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming

AND NOT operator on Ninja Trader script?!?
Started:November 26th, 2011 (06:48 AM) by vgbouchet Views / Replies:1,214 / 3
Last Reply:November 26th, 2011 (11:53 PM) Attachments:0

Welcome to

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

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, and we will never resell your private information.

-- Big Mike

Thread Tools Search this Thread

AND NOT operator on Ninja Trader script?!?

Old November 26th, 2011, 06:48 AM   #1 (permalink)
Trading Apprentice
Buenos Aires
Futures Experience: Intermediate
Platform: AT
Favorite Futures: ES, 6E
Posts: 3 since Jun 2011
Thanks: 0 given, 0 received

AND NOT operator on Ninja Trader script?!?

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

Old November 26th, 2011, 06:59 AM   #2 (permalink)
Elite Member
Calcutta, India
Futures Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks: 161 given, 255 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:

Old November 26th, 2011, 12:00 PM   #3 (permalink)
Elite Member
Portland Oregon, United States
Futures Experience: Beginner
Platform: NinjatraderŽ
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay KlownbineŽ Trading of Globex
Zondor's Avatar
Posts: 1,276 since Jul 2009
Thanks: 1,227 given, 2,442 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.

Last edited by Zondor; November 26th, 2011 at 12:27 PM.
Reply With Quote
The following 2 users say Thank You to Zondor for this post:

Old November 26th, 2011, 11:53 PM   #4 (permalink)
Site Administrator
Manta, Ecuador
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
Big Mike's Avatar
Posts: 45,432 since Jun 2009
Thanks: 28,836 given, 79,556 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

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote

Reply > Futures Trading, News, Charts and Platforms > Platforms and Indicators > NinjaTrader > NinjaTrader Programming > AND NOT operator on Ninja Trader script?!?

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Upcoming Webinars and Events (4:30PM ET unless noted)

An Afternoon with FIO trader bobwest

Elite only

NinjaTrader 8: Programming Profitable Trading Edges w/Scott Hodson

Elite only

Anthony Drager: Executing on Intermarket Correlations & Order Flow, Part 2

Elite only

Adam Grimes: Five critically important keys to professional trading

Elite only

Machine Learning Concepts w/FIO member NJAMC

Elite only

MarketDelta Cloud Platform: Announcing new mobile features

Dec 1

NinjaTrader 8: Features and Enhancements

Dec 6

Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help for a very simple script for Ninja Trader vgbouchet NinjaTrader Programming 7 December 1st, 2011 03:06 PM
Easy Language to Ninja Script fireman912 NinjaTrader Programming 4 June 23rd, 2011 10:39 PM
Ninja script - learning code + programming alias NinjaTrader Programming 20 May 11th, 2011 05:01 AM
HELP with RECOMMENDING a Ninja Script Consultant plz... mdsvtr Vendors and Product Reviews 3 November 6th, 2010 10:12 AM
Ninja Script Import Problem jdella NinjaTrader 5 November 6th, 2009 09:57 AM

All times are GMT -4. The time now is 01:39 AM.

Copyright © 2016 by 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

Page generated 2016-10-22 in 0.08 seconds with 27 queries on phoenix via your IP