Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Condition Counter Paint Bar
Collapse
X
-
Condition Counter Paint Bar
I would like to put together a paint bar based off several conditions. I have very rudimentary coding skills and have been doing it a clunky sort of way with large nested 'if-else' and '&&' statements. My most recent idea won't work with the way I have been doing it and was wondering if I could put in a 'counter' value. So if 'condition 1' is true is adds 1 to the condition counter, the same for condition 2, condition 3, etc. Then if the counter is high enough the paint bar goes on. It seems simple enough I was just wondering if someone could point me in the direction to start looking. I will need to figure things out so I will probably be back... Thanks in advance!Tags: None
-
Hello Mabba,
Thanks for your post.
The simplest approach is to create an int variable that you can use as a counter and to set up your individual if statements where the action for each is to increment the counter. At the beginning of the if statements you would set the counter to 0 (zero), at the end of the if statements you would perform some action based on the value of the counter. Here is a simple example:
int myCounter = 0; // reset to zero
if (Condition 1)
{
myCounter++; // increment the counter by 1
}
if (Condition 2)
{
myCounter++; // increment the counter by 1
}
if (Condition 3)
{
myCounter++; // increment the counter by 1
}
if (Condition 4)
{
myCounter++; // increment the counter by 1
}
if (Condition 5)
{
myCounter++; // increment the counter by 1
}
if (myCounter >= 3)
{
// perform some action
}
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
647 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
368 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
108 views
0 likes
|
Last Post
by Mindset
02-09-2026, 11:44 AM
|
||
|
Started by Geovanny Suaza, 02-02-2026, 12:30 PM
|
0 responses
571 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
573 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment