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 Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        656 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        371 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        109 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        574 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        579 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X