Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
Change "Color for up bars" in indicator
Collapse
X
-
Change "Color for up bars" in indicator
I have an indicator that changes BarColor based on certain criteria, and it works fine. I want to use Line on Close for Bar type, when I do, BarColor has no effect on that color. How can I access the "Color for up bars" (which does change the color) property to change the color in the indicator. I've searched the Ninja Script reference and did a search of the forums, with no luck. But, I could have missed it. Anyone know?Tags: None
-
Hi ghoti,
Unfortunately, that is outside of the scope of support I can offer. Hopefully someone here will be able to provide some hints.
As a workaround, you could simply create a plot connecting the close prices, then color the plot as you see fit from your code.Last edited by NinjaTrader_Tim; 07-29-2010, 01:34 PM.TimNinjaTrader Customer Service
-
If you want to set the color of something in your indicator to the same color as the Up or Down color of the price bar, use the ChartControl properties. ie: ChartControl.UpColor
The following snippet lets you access the colors set by "Color for down bars" & "Color for up bars"
It you only need to set your values once, It is possible to use this in the Initialize() method as well as the OnBarUpdate() & Plot() methods.Code:[FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] (UsePriceColors) {[/SIZE][/FONT] [SIZE=2][FONT=Courier New] colorVolUp = ChartControl.UpColor;[/FONT][/SIZE] [SIZE=2][FONT=Courier New] colorVolDown = ChartControl.DownColor;[/FONT][/SIZE] [SIZE=2][FONT=Courier New]}[/FONT][/SIZE] [/SIZE][/FONT]
enjoyLast edited by David Lean; 05-13-2011, 06:32 AM.
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Hwop38, 05-04-2026, 07:02 PM
|
0 responses
160 views
0 likes
|
Last Post
by Hwop38
05-04-2026, 07:02 PM
|
||
|
Started by CaptainJack, 04-24-2026, 11:07 PM
|
0 responses
307 views
0 likes
|
Last Post
by CaptainJack
04-24-2026, 11:07 PM
|
||
|
Started by Mindset, 04-21-2026, 06:46 AM
|
0 responses
244 views
0 likes
|
Last Post
by Mindset
04-21-2026, 06:46 AM
|
||
|
Started by M4ndoo, 04-20-2026, 05:21 PM
|
0 responses
348 views
0 likes
|
Last Post
by M4ndoo
04-20-2026, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
178 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|

Comment