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 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