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 Hwop38, 05-04-2026, 07:02 PM
        0 responses
        160 views
        0 likes
        Last Post Hwop38
        by Hwop38
         
        Started by CaptainJack, 04-24-2026, 11:07 PM
        0 responses
        307 views
        0 likes
        Last Post CaptainJack  
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        244 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        348 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        178 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Working...
        X