Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Color defaults wont save

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

    Color defaults wont save

    Hi,

    I have coded an indicator that has definable colors for all lines and text drawn by indicator.

    Everything works fine expect the default colors always revert back to the set color where defined in variables. Even after saving the defaults.... The original parameters can be saved but the colors wont stay.

    I have trawled the internet looking for answers and found someone else with a simlar problem which was solved by removing the " XmlIgnore" however this just takes the colors away altogether in which case they need to be defined every time the indicator is run.

    The funny thing is that i got the below code from another program that someone else coded and it works fine and holds the values in that program... but not in mine... :-(

    Can anyone make any suggestions?





    [Description("Text Colour for last Alert2"), XmlIgnore, VisualizationOnly]
    [GridCategory("Status panel")]
    [NinjaTrader.Gui.Design.DisplayName("Levels Color")]
    public Color LevelNormal
    {
    get { return this.textbrushOff.Color; }
    set { this.textbrushOff = new SolidBrush(value); }
    }

    #2
    I think this is where the serializable comes in...




    Originally posted by marty087 View Post
    Hi,

    I have coded an indicator that has definable colors for all lines and text drawn by indicator.

    Everything works fine expect the default colors always revert back to the set color where defined in variables. Even after saving the defaults.... The original parameters can be saved but the colors wont stay.

    I have trawled the internet looking for answers and found someone else with a simlar problem which was solved by removing the " XmlIgnore" however this just takes the colors away altogether in which case they need to be defined every time the indicator is run.

    The funny thing is that i got the below code from another program that someone else coded and it works fine and holds the values in that program... but not in mine... :-(

    Can anyone make any suggestions?





    [Description("Text Colour for last Alert2"), XmlIgnore, VisualizationOnly]
    [GridCategory("Status panel")]
    [NinjaTrader.Gui.Design.DisplayName("Levels Color")]
    public Color LevelNormal
    {
    get { return this.textbrushOff.Color; }
    set { this.textbrushOff = new SolidBrush(value); }
    }

    Comment


      #3
      Originally posted by sledge View Post
      I think this is where the serializable comes in...
      As koganam said



      "Any inputs that are not serializable, if changed from the defaults, will not be saved with the indicator, unless you make your own arrangements to serialize such."

      search here

      Comment


        #4
        Thanks Sledge. Much appreciated.

        Here is the code i added... Works a charm.

        [Browsable(false)]
        public string LevelNormalColorSerialize
        {
        get { return SerializableColor.ToString(this.LevelNormal); }
        set { this.LevelNormal = SerializableColor.FromString(value); }
        }

        Comment


          #5
          Originally posted by marty087 View Post
          Thanks Sledge. Much appreciated.

          Here is the code i added... Works a charm.

          [Browsable(false)]
          public string LevelNormalColorSerialize
          {
          get { return SerializableColor.ToString(this.LevelNormal); }
          set { this.LevelNormal = SerializableColor.FromString(value); }
          }
          Have you remembered to dispose of your textBrushes ?

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          576 views
          0 likes
          Last Post Geovanny Suaza  
          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
          0 responses
          334 views
          1 like
          Last Post Geovanny Suaza  
          Started by Mindset, 02-09-2026, 11:44 AM
          0 responses
          101 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
          0 responses
          553 views
          1 like
          Last Post Geovanny Suaza  
          Started by RFrosty, 01-28-2026, 06:49 PM
          0 responses
          551 views
          1 like
          Last Post RFrosty
          by RFrosty
           
          Working...
          X