NexusFi: Find Your Edge


Home Menu

 





Help with Bool in indicator.


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one bobwest with 2 posts (0 thanks)
    2. looks_two kidvic with 2 posts (0 thanks)
    3. looks_3 ctnz with 2 posts (0 thanks)
    4. looks_4 Zxeses with 2 posts (0 thanks)
    1. trending_up 1,779 views
    2. thumb_up 0 thanks given
    3. group 3 followers
    1. forum 8 posts
    2. attach_file 0 attachments




 
Search this Thread

Help with Bool in indicator.

  #1 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3

Can a bool have too many conditions where the script just won't work?

for example.
somecondition will always be different.

bool C1 = "somecondition" && "somecondition";

all the way up too..... '

bool C48 = "somecondition" && "someconditions" && "somecondition" && "somecondition" && "somecondition" && "somecondition" && somecondition" && "somecondition;


I'm able to have C1 - C3 work, but after C4, my script doesn't draw the plot anymore, as if the script just doesn't work anymore.
All logic is valid, as there are no errors. At this point these are just bools, and the plot isn't actually tied to the conditions of the bools so I'm confused.

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Ninja Mobile Trader VPS (ninjamobiletrader.com)
Trading Reviews and Vendors
ZombieSqueeze
Platforms and Indicators
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
  #3 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,162 since Jan 2013
Thanks Given: 57,344
Thanks Received: 26,267



kidvic View Post
Can a bool have too many conditions where the script just won't work?

for example.
somecondition will always be different.

bool C1 = "somecondition" && "somecondition";

all the way up too..... '

bool C48 = "somecondition" && "someconditions" && "somecondition" && "somecondition" && "somecondition" && "somecondition" && somecondition" && "somecondition;


I'm able to have C1 - C3 work, but after C4, my script doesn't draw the plot anymore, as if the script just doesn't work anymore.
All logic is valid, as there are no errors. At this point these are just bools, and the plot isn't actually tied to the conditions of the bools so I'm confused.

Your problem isn't because you have 4 bools, or however many you have there.

Without the full code, it's not going to be possible to find the error.

(BTW, the fact that there are no compile errors, if that's what you meant, does not mean that the logic is valid. I have a lot of experience with writing code that compiles, and runs with no errors, but that just is wrong.... )

If you can post the code and a description of what it does, someone can help.

Bob.

Reply With Quote
  #4 (permalink)
kidvic
Los Angeles, CA
 
Posts: 92 since Mar 2015
Thanks Given: 13
Thanks Received: 3


bobwest View Post
Your problem isn't because you have 4 bools, or however many you have there.

Without the full code, it's not going to be possible to find the error.

(BTW, the fact that there are no compile errors, if that's what you meant, does not mean that the logic is valid. I have a lot of experience with writing code that compiles, and runs with no errors, but that just is wrong.... )

If you can post the code and a description of what it does, someone can help.

Bob.

I just added one more condition to the last bool, and like I said, the plot is not tied to these bools.
So why would that even make a difference.

Reply With Quote
  #5 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,162 since Jan 2013
Thanks Given: 57,344
Thanks Received: 26,267


kidvic View Post
I just added one more condition to the last bool, and like I said, the plot is not tied to these bools.
So why would that even make a difference.

Again, this kind of question cannot be answered without seeing the rest of the code, or at least enough to understand what is going on.

For what it's worth, C# does not have any restriction on the number of boolean conditions you use, so the solution is likely in something else.

But, without being able to see what the code is doing, it is hard to help.

There are many good programmers here who will try to help, but without the code, just dealing with general questions like this makes it impossible to answer.

I will help if I am able, but you need to make it possible to get the help. I am sure someone else would also pitch in.

Your choice.

Bob.

Reply With Quote
  #6 (permalink)
 
Zxeses's Avatar
 Zxeses 
San Francisco CA
 
Experience: Intermediate
Platform: Ninja
Broker: CQG
Trading: ES
Posts: 139 since Jun 2014
Thanks Given: 90
Thanks Received: 172


kidvic View Post
Can a bool have too many conditions where the script just won't work?

for example.
somecondition will always be different.

bool C1 = "somecondition" && "somecondition";

all the way up too..... '

bool C48 = "somecondition" && "someconditions" && "somecondition" && "somecondition" && "somecondition" && "somecondition" && somecondition" && "somecondition;


I'm able to have C1 - C3 work, but after C4, my script doesn't draw the plot anymore, as if the script just doesn't work anymore.
All logic is valid, as there are no errors. At this point these are just bools, and the plot isn't actually tied to the conditions of the bools so I'm confused.

Each condition returns its own bool, either a 1 true or a zero false. Any one condition in your example can set the resultant total bool to false unless ALL the conditions are met, take these for understanding:

Bool myResultbool = true && true && true && false
myResultbool = false

All it takes is one false to make the result bool false. The reverse of this gives the reverse result:

Bool myResultbool = false || false || false || true
myResultbool = true

Make sense?

Visit my NexusFi Trade Journal Reply With Quote
  #7 (permalink)
ctnz
Invercargill, New Zealand
 
Posts: 48 since Jan 2012
Thanks Given: 4
Thanks Received: 168

Zxeses

You can use nested if's

For example
bool C48 = false;
if (somecondition" && "someconditions" && "somecondition" )
{
if (somecondition2" && "someconditions3" && "somecondition4" )
{
C48 = true;
}
}

But reading between the lines if you have that many conditions you are curve fitting to historical data trying to find rare conditions or some magic combination of indicator values that will rarely be met or repeated hoping for a high win percentage. The simplest methods are the most robust and flexible. Also I would guess you are looking at oscillators which at best tell you what just happened and are no more effective at telling the future than a dice roll. You need to find market fundamentals and use those conditions to base your decisions. Take all this as a grain of salt from someone who has been a programmer for close to 40 years, so I guess I know nothing.

Most likely you will thunder on Don Quixote until you see the futility of your ways. Most of the learning is at the end of the quest, denial dies hard, acceptance hurts.

Sorry if I sound more than a bit cynical but seen too many programmers before you bite the dust hard on the search for the holy grail. Best of luck.

Reply With Quote
  #8 (permalink)
 
Zxeses's Avatar
 Zxeses 
San Francisco CA
 
Experience: Intermediate
Platform: Ninja
Broker: CQG
Trading: ES
Posts: 139 since Jun 2014
Thanks Given: 90
Thanks Received: 172


ctnz View Post
Zxeses

You can use nested if's

Ctnz, your post should be directed at the person asking the question, not the people trying to help him.

-Zx

Visit my NexusFi Trade Journal Reply With Quote
  #9 (permalink)
ctnz
Invercargill, New Zealand
 
Posts: 48 since Jan 2012
Thanks Given: 4
Thanks Received: 168

Zxeses

My extreme apologies. Major boo-boo on my part especially to someone in the Bay Area. I guess I hit the wrong reply button.

Should I re-reply or will KidVic see my post?

Reply With Quote




Last Updated on October 18, 2015


© 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