NexusFi: Find Your Edge


Home Menu

 





AND NOT operator on Ninja Trader script?!?


Discussion in NinjaTrader

Updated
      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,860 views
    2. thumb_up 5 thanks given
    3. group 3 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

AND NOT operator on Ninja Trader script?!?

  #1 (permalink)
vgbouchet
Buenos Aires
 
Posts: 3 since Jun 2011
Thanks Given: 0
Thanks Received: 0

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.

Regards,

Victor

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
Deepmoney LLM
Elite Quantitative GenAI/LLM
Futures True Range Report
The Elite Circle
Better Renko Gaps
The Elite Circle
 
  #2 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271

&& = AND ALSO

not = !

like

if (x != y)
{
//do something
}

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

Reply With Quote
Thanked by:
  #3 (permalink)
 
Zondor's Avatar
 Zondor 
Portland Oregon, United States
 
Experience: Beginner
Platform: NinjatraderŽ
Broker: CQG, Kinetick
Trading: Gameplay KlownbineŽ Trading of Globex
Posts: 1,333 since Jul 2009
Thanks Given: 1,246
Thanks Received: 2,731


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)


 
Code

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)

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

Also, as in the previous example, the UNEQUAL TO operator is != .
NOT GREATER THAN !>
NOT LESS THAN !<

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 NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,399 since Jun 2009
Thanks Given: 33,175
Thanks Received: 101,541

 
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 the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote




Last Updated on November 26, 2011


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts