Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
How can I use NinjaScript to change candle wick color?
Collapse
X
-
How can I use NinjaScript to change candle wick color?
How do I access this property using NinjaScript? It's not the same as CandleOutlineBrush.Tags: None
-
Shawn,
It turns out there's a "stroke2" property I was able to access to alter the wick directly.
CandleOutlineBrush takes care of the body, but the "stroke2" option is just the wicks.
Thanks,
Adam
Comment
-
Code
Originally posted by user_456 View PostWould you be so kind as to reply with your code for changing the wick colors conditionally? Thanks
Code:/// This section gets added at the top of the indicator // Define a Chart object to refer to the chart on which the indicator resides private Chart chartWindow; /// This gets called in a custom function that is called on in “State.Historical” //Obtain the Chart on which the indicator is configured chartWindow = Window.GetWindow(this.ChartControl.Parent) as Chart; if (chartWindow == null) { Print("chartWindow == null"); return; } /// This is called after a button press, but could be called at any time – this actually hides the wicks foreach (var obj in chartWindow.ActiveChartControl.ChartObjects) { var wicks = obj as ChartBars; if (wicks != null) { switch (wicks.Properties.ChartStyle.Stroke2.Brush.ToString()) { case "#FF000000": { wicks.Properties.ChartStyle.Stroke2.Brush = Brushes.Transparent; break; } case "#00FFFFFF": { wicks.Properties.ChartStyle.Stroke2.Brush = Brushes.Black; break; } default: { wicks.Properties.ChartStyle.Stroke2.Brush = Brushes.Black; break; } } } } chartWindow.ActiveChartControl.InvalidateVisual(); ForceRefresh();
- Likes 1
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by Mindset, Today, 06:46 AM
|
0 responses
8 views
0 likes
|
Last Post
by Mindset
Today, 06:46 AM
|
||
|
Started by M4ndoo, Yesterday, 05:21 PM
|
0 responses
13 views
0 likes
|
Last Post
by M4ndoo
Yesterday, 05:21 PM
|
||
|
Started by M4ndoo, 04-19-2026, 05:54 PM
|
0 responses
15 views
0 likes
|
Last Post
by M4ndoo
04-19-2026, 05:54 PM
|
||
|
Started by cmoran13, 04-16-2026, 01:02 PM
|
0 responses
82 views
0 likes
|
Last Post
by cmoran13
04-16-2026, 01:02 PM
|
||
|
Started by PaulMohn, 04-10-2026, 11:11 AM
|
0 responses
47 views
0 likes
|
Last Post
by PaulMohn
04-10-2026, 11:11 AM
|

Comment