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 CarlTrading, 03-31-2026, 09:41 PM
        1 response
        156 views
        1 like
        Last Post NinjaTrader_ChelseaB  
        Started by CarlTrading, 04-01-2026, 02:41 AM
        0 responses
        90 views
        1 like
        Last Post CarlTrading  
        Started by CaptainJack, 03-31-2026, 11:44 PM
        0 responses
        140 views
        2 likes
        Last Post CaptainJack  
        Started by CarlTrading, 03-30-2026, 11:51 AM
        0 responses
        130 views
        1 like
        Last Post CarlTrading  
        Started by CarlTrading, 03-30-2026, 11:48 AM
        0 responses
        107 views
        0 likes
        Last Post CarlTrading  
        Working...
        X