Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Custom Color Input Doesnt Save

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

    Custom Color Input Doesnt Save

    Hello everyone,
    When creating a custom color input for a drawing object, it does not save when saving the workspace or when saving the indicator as default. On next load up, its back to the base color within the source. Is there a workaround for this or how does one fix this? Here is the source for reference.

    Code:
    .....State.SetDefaults
    DevColor = Brushes.DarkSlateGray;
    
    ....OnBarUpdate
    SolidColorBrush scb1 = DevColor as SolidColorBrush;
    SolidColorBrush newDevColor = new SolidColorBrush(Color.FromArgb((byte)(2.55*DevOpacity),scb1.Color.R,scb1.Color.G,scb1.Color.B));​​
    newDevColor.Freeze();​
    Code:
    [Range(0, int.MaxValue), NinjaScriptProperty]
    [Display(ResourceType = typeof(Custom.Resource), Name = "Dev Line Opacity", GroupName = "Base Deviations", Order = 9)]
    public byte DevOpacity
    { get; set; }​
    
    [NinjaScriptProperty]
    [XmlIgnore]
    [Display(Name = "Dev Line Color", GroupName = "Base Deviations", Order = 8)]
    public Brush DevColor    
    { get; set; }​
    Last edited by ChrisR; 06-09-2023, 06:20 AM.

    #2
    Hello, thanks for writing in. The brush needs to be serialized so it can be saved to the XML file. See here for an example on how to do this:

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hello, thanks for writing in. The brush needs to be serialized so it can be saved to the XML file. See here for an example on how to do this:
      https://ninjatrader.com/support/help...definedbrushes
      That did the trick, thanks!
      Last edited by ChrisR; 06-09-2023, 01:17 PM.

      Comment


        #4
        Happy to help.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        44 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        56 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        35 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        95 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        57 views
        0 likes
        Last Post PaulMohn  
        Working...
        X