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!
See more
See less

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:
    Chris L.NinjaTrader Customer Service

    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.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Jonafare, 12-06-2012, 03:48 PM
        5 responses
        3,984 views
        0 likes
        Last Post rene69851  
        Started by Fitspressorest, Today, 01:38 PM
        0 responses
        2 views
        0 likes
        Last Post Fitspressorest  
        Started by Jonker, Today, 01:19 PM
        0 responses
        2 views
        0 likes
        Last Post Jonker
        by Jonker
         
        Started by futtrader, Today, 01:16 PM
        0 responses
        6 views
        0 likes
        Last Post futtrader  
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,791 views
        0 likes
        Last Post aligator  
        Working...
        X