Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
To color only two bars, bull bar and a follow thru bar.
Collapse
X
-
To color only two bars, bull bar and a follow thru bar.
I have to add a new line in the code? For the right condition.Tags: None
-
Hello trdninstyle,
Thank you for your reply.
You'd need to use BarBrushes[barsAgo]:
Where PaintColor is a variable holding a brush we want to use to paint the bars.Code:if(Close[0] >= Open[0] && Close[1] >= Open[1]) { BarBrushes[0] = PaintColor; BarBrushes[1] = PaintColor; } else { BarBrushes[0] = null; }
Please let us know if we may be of further assistance to you.
-
Thank you, Kate, for that! You are the most awesome!! And that comes with two exclamation points. I'll go try that now.
Comment
-
Comment
-
Hello trdninstyle,
Thank you for your reply.
As I mentioned, PaintColor is just an example variable, which should be replaced either with your own variable containing a brush or just assign a brush color directly there, like:
BarBrushes[0] = Brushes.Orange;
Please let us know if we may be of further assistance to you.
Comment
-
Hello Kate,
I replaced 'PaintColor' with my own, 'Brushes.Orange; (I was later going to change it to orange). Since I have on line 54 ;BorderBrush = Brushes.SeaGreen; is that my variable? The BorderBrush?
Because most of the consecutive (2 in a row) bull bars paint orange but the rest are painting sea green.
Comment
-
Comment
-
Hello trdninstyle,
Thank you for your reply.
If you want to restrict it to painting just the first 2 in a row before a normally painted bar, try this:
Please let us know if we may be of further assistance to you.Code:if(CurrentBar < 2) return; if(Close[0] >= Open[0] && Close[1] >= Open[1] && BarBrushes[2] != Brushes.Orange) { BarBrushes[0] = Brushes.Orange; BarBrushes[1] = Brushes.Orange; } else { BarBrushes[0] = null; }
Comment
-
Comment
-
Below the BarBrushes[0]= null; I still have BarBrush = BorderBrush; Not sure if that still should be there? Or if it is supposed to be there? If not, could be messing things up.
I didnt see your last reply, sorry. For a code sample what does that involved? I can copy/past my entire code that I have now.Last edited by trdninstyle; 09-16-2022, 01:29 PM.
Comment
-
-
Yes, that worked, Kate.
A breakout bar would be a close above previous bar's, I was trying to write that in regard to the current bar like this for example. if(Close[0] >= Open[0] && Close[0] >= High[1]
So, the current bars close is above previous last couple of bars. Thats what I'm trying to display, taking what I have now & improving on it.
Comment
-
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Geovanny Suaza, 02-11-2026, 06:32 PM
|
0 responses
650 views
0 likes
|
Last Post
|
||
|
Started by Geovanny Suaza, 02-11-2026, 05:51 PM
|
0 responses
370 views
1 like
|
Last Post
|
||
|
Started by Mindset, 02-09-2026, 11:44 AM
|
0 responses
109 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
574 views
1 like
|
Last Post
|
||
|
Started by RFrosty, 01-28-2026, 06:49 PM
|
0 responses
577 views
1 like
|
Last Post
by RFrosty
01-28-2026, 06:49 PM
|

Comment