Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Custom Color Plotting - Saving Preferences and Overriding defaults
Collapse
X
-
Originally posted by NinjaTrader_JoshG View Post
-
Hello MarthaClines,
Thanks for your post.
It looks like you are using the XMLIgnore Attribute with your brush properties which would prevent those properties from being saved in a template or workspace.
Leave a comment:
-
Originally posted by MarthaClines View PostHello:
I have multiple custom indicators that have plots with alternating colors based on certain market conditions. For example, I have a paint bar system that paints the candle bar 4 different colors based on core logic. I have these variables declared as follows:
I have the defaults set under the on state change event were State == State.SetDefaults as follows:
Everything is working fine, calculating and plotting correctly - with the correct color with one small annoying exception.
When a user decides to change the default colors by going to the settings (CONTROL+I) they are able to do so successfully and the indicator once again plots correctly with the newly selected color. HOWEVER, when the user closes NT8, even after saving the workspace, and reloads it, the old default colors are being used and not the ones the user changed it to. The settings for the colors are coded as follows:
What I am looking to accomplish is to allow the user to select colors other than the defaults that are provided with the indicator and for those colors to presist after NT8 is shutdown and reloaded. It seems saving the workspace is not working. At present, everytime NT8 is reloaded - the colors have to be changed again.
Thanks
One easy way is to set the custom colors as desired then in the indicator properties window click on template (at bottom right corner) and save the template as Default. And you have it, your custom colors will show on restart.
If you want to go back to the original settings then click on template then click reset to go back to original colors.
Cheers!
Leave a comment:
-
Custom Color Plotting - Saving Preferences and Overriding defaults
Hello:
I have multiple custom indicators that have plots with alternating colors based on certain market conditions. For example, I have a paint bar system that paints the candle bar 4 different colors based on core logic. I have these variables declared as follows:
private Brush _upColor;
private Brush _dwnColor;
private Brush _volSpikeUpColor;
private Brush _volSpikeDownColor;
_upColor = Brushes.CornflowerBlue;
_dwnColor = Brushes.Crimson;
_volSpikeUpColor = Brushes.Lime;
_volSpikeDownColor = Brushes.Magenta;
When a user decides to change the default colors by going to the settings (CONTROL+I) they are able to do so successfully and the indicator once again plots correctly with the newly selected color. HOWEVER, when the user closes NT8, even after saving the workspace, and reloads it, the old default colors are being used and not the ones the user changed it to. The settings for the colors are coded as follows:
[Display(ResourceType = typeof(Custom.Resource), Name = "Up Color", GroupName = "Settings Colors", Order = 0), XmlIgnore]
public Brush UpColor
{
get { return _upColor; }
set { _upColor = value; }
}
[Browsable(false), XmlIgnore]
public string UpColorSerialize
{
get { return Serialize.BrushToString(_upColor); }
set { _upColor = Serialize.StringToBrush(value); }
}
[Display(ResourceType = typeof(Custom.Resource), Name = "Down Color", GroupName = "Settings Colors", Order = 0), XmlIgnore]
public Brush DownColor
{
get { return _dwnColor; }
set { _dwnColor = value; }
}
[Display(ResourceType = typeof(Custom.Resource), Name = "Up Volume Spike", GroupName = "Settings Volume", Order = 0), XmlIgnore]
public Brush volSpikeUpColor
{
get { return _volSpikeUpColor; }
set { _volSpikeUpColor = value; }
}
[Browsable(false), XmlIgnore]
public string volSpikeUpColorSerialize
{
get { return Serialize.BrushToString(_volSpikeUpColor); }
set { _volSpikeUpColor = Serialize.StringToBrush(value); }
}
[Display(ResourceType = typeof(Custom.Resource), Name = "Down Volume Spike", GroupName = "Settings Volume", Order = 1), XmlIgnore]
public Brush volSpikeDownColor
{
get { return _volSpikeDownColor; }
set { _volSpikeDownColor = value; }
}
[Browsable(false), XmlIgnore]
public string volSpikeDownColorSerialize
{
get { return Serialize.BrushToString(_volSpikeDownColor); }
set { _volSpikeDownColor = Serialize.StringToBrush(value); }
}
[Display(ResourceType = typeof(Custom.Resource), Name = "Alerts On", GroupName = "Settings Volume", Order = 3), XmlIgnore]
public bool volAlert
{
get { return _volAlert;}
set { _volAlert = value;}
}
[Display(ResourceType = typeof(Custom.Resource), Name = "Volume Threshold", GroupName = "Settings Volume", Order = 2), XmlIgnore]
public double volThreshold
{
get { return _volThreshold;}
set { _volThreshold = value;}
}
ThanksTags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by The_Sec, Yesterday, 03:37 PM
|
1 response
11 views
0 likes
|
Last Post Today, 06:17 AM | ||
Started by vecnopus, Today, 06:15 AM
|
0 responses
1 view
0 likes
|
Last Post
by vecnopus
Today, 06:15 AM
|
||
Started by Aviram Y, Today, 05:29 AM
|
0 responses
5 views
0 likes
|
Last Post
by Aviram Y
Today, 05:29 AM
|
||
Started by quantismo, 04-17-2024, 05:13 PM
|
3 responses
27 views
0 likes
|
Last Post Today, 05:23 AM | ||
Started by ScottWalsh, 04-16-2024, 04:29 PM
|
7 responses
36 views
0 likes
|
Last Post Today, 05:15 AM |
Leave a comment: