NexusFi: Find Your Edge


Home Menu

 





Working with bools


Discussion in NinjaTrader

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




 
Search this Thread

Working with bools

  #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?
Better Renko Gaps
The Elite Circle
MC PL editor upgrade
MultiCharts
Quantum physics & Trading dynamics
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
ZombieSqueeze
Platforms and Indicators
 
  #3 (permalink)
 wavey 
Germany / Italy
 
Experience: Advanced
Platform: NT8, TS, TV
Trading: Index Futures, FX
Posts: 83 since Nov 2009
Thanks Given: 51
Thanks Received: 37



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


© 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