I would like to get a value of a serializable color from indicator and if color changes from say red to green enter long. the print statement for this value shows: Buy: <SolidColorBrush xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">#FF008000</SolidColorBrush> So if I can say if previous value one color and current value new color then enter long. I have no control over the indicator so I cannot add a public variable for it, I need to read the value and compare to previous value
Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
parse the color code from serializable value to use as a condition for entry
Collapse
X
-
parse the color code from serializable value to use as a condition for entry
Hi,
I would like to get a value of a serializable color from indicator and if color changes from say red to green enter long. the print statement for this value shows: Buy: <SolidColorBrush xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation">#FF008000</SolidColorBrush> So if I can say if previous value one color and current value new color then enter long. I have no control over the indicator so I cannot add a public variable for it, I need to read the value and compare to previous valueTags: None
-
yes printing BuyArea does show the color code. But I need the value serialzed as I need to know when the color changes. I can't index the BuyArea, cant apply indexing to media.brush is compilation error. Could I use if ( (MyIndy.Value [0] && MyIndy.BuyArea == green) && (MyIndy.Value[1] && MyIndy.BuyArea == red) Disregard the color coding at this point.Last edited by set2win; 03-31-2022, 02:21 PM.
Comment
-
Hello set2win,
I'm not sure I understand.
Serializing means making the input savable in XML like workspaces and templates.
This means making a savable string for a public variable so its saved in XML.
Below is a link to the help guide on serializing brush inputs.
https://ninjatrader.com/support/help...th_brushes.htm
A Brush is not collection and cannot be indexed. Are asking about PlotBrushes which is a collection.
If you need to know when the color changes then you need implement INotifyChanged with an OnPropertyChanged handler.
Or you could save the value, and check to see if its changed.
Checking the color would be similar to MyIndy.BuyArea == Brushes.Green. You have to compare like types with like types.
MyIndy.Value[0] is likely a double and not a bool. 'if ( (MyIndy.Value [0]' <-- this doesn't make sense. This must be compared with a number.Chelsea B.NinjaTrader Customer Service
Comment
Latest Posts
Collapse
| Topics | Statistics | Last Post | ||
|---|---|---|---|---|
|
Started by NullPointStrategies, 03-13-2026, 05:17 AM
|
0 responses
87 views
0 likes
|
Last Post
|
||
|
Started by argusthome, 03-08-2026, 10:06 AM
|
0 responses
151 views
0 likes
|
Last Post
by argusthome
03-08-2026, 10:06 AM
|
||
|
Started by NabilKhattabi, 03-06-2026, 11:18 AM
|
0 responses
80 views
0 likes
|
Last Post
|
||
|
Started by Deep42, 03-06-2026, 12:28 AM
|
0 responses
53 views
0 likes
|
Last Post
by Deep42
03-06-2026, 12:28 AM
|
||
|
Started by TheRealMorford, 03-05-2026, 06:15 PM
|
0 responses
62 views
0 likes
|
Last Post
|

Comment