• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Color Plotting - Saving Preferences and Overriding defaults

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • MarthaClines
    replied
    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.

    https://ninjatrader.com/support/help...eattribute.htm
    WOW thanks you Mr Josh - the XmLIgnore attribute was the issue. Working like a champ now

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    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.

    https://ninjatrader.com/support/help...eattribute.htm

    Leave a comment:


  • aligator
    replied
    Originally posted by MarthaClines View Post
    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:



    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
    This is because Ninja on restart uses the default indicator templates.

    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;
    I have the defaults set under the on state change event were State == State.SetDefaults as follows:

    _upColor = Brushes.CornflowerBlue;
    _dwnColor = Brushes.Crimson;
    _volSpikeUpColor = Brushes.Lime;
    _volSpikeDownColor = Brushes.Magenta;
    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:

    [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;}
    }
    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

Latest Posts

Collapse

Topics Statistics Last Post
Started by fredrikn, 05-08-2019, 04:01 AM
17 responses
668 views
1 like
Last Post emtrader  
Started by zacharydw00, Yesterday, 10:19 PM
0 responses
2 views
0 likes
Last Post zacharydw00  
Started by chafan11, Yesterday, 09:28 PM
0 responses
6 views
0 likes
Last Post chafan11  
Started by GreenspanAlec, Yesterday, 05:32 PM
0 responses
7 views
0 likes
Last Post GreenspanAlec  
Started by mrwarkhan, Yesterday, 03:45 PM
0 responses
18 views
0 likes
Last Post mrwarkhan  
Working...
X