Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with Color Parameter

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

    Problem with Color Parameter

    I have an indicator that draws a couple lines and a rectangle. I'd like the user to be able to change the color of the lines and the fill color of the rectangle. In the parameters section I have this:

    [Description("Line Color")]
    [Category(
    "Parameters")]
    public Color D3_LineColor
    {
    get {return linecolor; }
    set { linecolor = value;}
    }

    This works OK if I add the indicator to a chart. It defaults to the color that I set in the code. The problem happens when I save the chart as a template and then open a new chart using that template. All of the lines get set to a custom color (white) instead of the web color that I set in the code. If I remove and re-add the indicator, it works fine. Please help. Thanks.

    #2
    You need to serialize the color. Try this:

    [Browsable(false)]
    public string MyColorSerialize
    {
    get { return NinjaTrader.Gui.Design.SerializableColor.ToString( MyColor); }
    set { MyColor = NinjaTrader.Gui.Design.SerializableColor.FromStrin g(value); }
    }

    [XmlIgnore()]
    [Description("Color of the blah blah Line.")]
    [Category("Parameters")]
    [Gui.Design.DisplayNameAttribute("D3 Line Color")]
    public Color myColor
    {
    get { return MyColor; }
    set { MyColor = value; }
    }
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #3
      Double post.
      Last edited by eDanny; 06-12-2009, 07:44 PM.
      eDanny
      NinjaTrader Ecosystem Vendor - Integrity Traders

      Comment


        #4
        Thanks, that worked.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Geovanny Suaza, 02-11-2026, 06:32 PM
        0 responses
        581 views
        0 likes
        Last Post Geovanny Suaza  
        Started by Geovanny Suaza, 02-11-2026, 05:51 PM
        0 responses
        338 views
        1 like
        Last Post Geovanny Suaza  
        Started by Mindset, 02-09-2026, 11:44 AM
        0 responses
        103 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by Geovanny Suaza, 02-02-2026, 12:30 PM
        0 responses
        554 views
        1 like
        Last Post Geovanny Suaza  
        Started by RFrosty, 01-28-2026, 06:49 PM
        0 responses
        552 views
        1 like
        Last Post RFrosty
        by RFrosty
         
        Working...
        X