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 PaulMohn, Today, 03:49 AM
|
0 responses
4 views
0 likes
|
Last Post
by PaulMohn
Today, 03:49 AM
|
||
Started by inanazsocial, Today, 01:15 AM
|
1 response
7 views
0 likes
|
Last Post Today, 02:18 AM | ||
Started by rocketman7, Today, 02:12 AM
|
0 responses
10 views
0 likes
|
Last Post
by rocketman7
Today, 02:12 AM
|
||
Started by dustydbayer, Today, 01:59 AM
|
0 responses
2 views
0 likes
|
Last Post
by dustydbayer
Today, 01:59 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
5 responses
23 views
0 likes
|
Last Post Today, 12:32 AM |
Comment