NexusFi: Find Your Edge


Home Menu

 





Working with bools


Discussion in NinjaTrader

Updated
    1. trending_up 1,736 views
    2. thumb_up 0 thanks given
    3. group 2 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (permalink)
 kbaran 
Boynton Beach, FL
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
Posts: 24 since Jul 2011
Thanks Given: 0
Thanks Received: 3

I know that there is probably an easy way to do this, but I just can't figure it out.

Is there a way to use one true bool to make another bool true and the first one false? This is not working, bool2 does not become true, and bool1 remains true. The point is that bool2 needs to be true the second time condition1 is true, but I don't know how to make this code count. Any help would be appreciated, Thanks... Example:

protected override void OnBarUpdate(){

if (condition1) // uparrow and short
bool1 = true; // this works

if (bool1 && condition1) // bool1 true, uparrow and short
bool1 = false; // this does not work
bool2 = true; // this does not work

if(condition2)
bool1 = false;
bool2 = false;
}


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
US Prop Firms Race Inside the CFTC Perimeter -- Tradeify …
Funded Trading Evaluation Firms
SEC and CFTC Unlock Customer Cross-Margining for Treasur …
Treasury Notes and Bonds
April 2026 Jobs Report: +115k vs +65k Expected
Traders Hideout
Kalshi Rockets to $22B, Passes Polymarket in Volume -- B …
Prediction Markets & Event Contracts
Wood Mackenzie Drops $200 Oil Forecast -- Airspace Expir …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
21 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
8 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Hello Im new here
5 thanks
  #3 (permalink)
 wavey 
Germany / Italy
 
Experience: Advanced
Platform: NT8, TS, TV
Trading: Index Futures, FX
Posts: 88 since Nov 2009
Thanks Given: 52
Thanks Received: 38



kbaran View Post
I know that there is probably an easy way to do this, but I just can't figure it out.

Is there a way to use one true bool to make another bool true and the first one false? This is not working, bool2 does not become true, and bool1 remains true. The point is that bool2 needs to be true the second time condition1 is true, but I don't know how to make this code count. Any help would be appreciated, Thanks... Example:

protected override void OnBarUpdate(){

if (condition1) // uparrow and short
bool1 = true; // this works

if (bool1 && condition1) // bool1 true, uparrow and short
bool1 = false; // this does not work
bool2 = true; // this does not work

if(condition2)
bool1 = false;
bool2 = false;
}

how about working with a BoolSeries so you can check via an index if the bool1 is true now and your # of bars back?


Reply With Quote
  #4 (permalink)
 kbaran 
Boynton Beach, FL
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES
Posts: 24 since Jul 2011
Thanks Given: 0
Thanks Received: 3

wavey

Thanks for the reply, but I tried a bool series and I could not get that to work. I also tried counting with an int and that hasn't worked. Still trying to figure a way.

Update, I found a way using bar index.

Thanks


Started this thread Reply With Quote




Last Updated on August 28, 2012


© 2026 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 - Downloads - Top
no new posts