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

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 MacDad, 02-25-2024, 11:48 PM
        7 responses
        158 views
        0 likes
        Last Post loganjarosz123  
        Started by Belfortbucks, Today, 09:29 PM
        0 responses
        6 views
        0 likes
        Last Post Belfortbucks  
        Started by zstheorist, Today, 07:52 PM
        0 responses
        7 views
        0 likes
        Last Post zstheorist  
        Started by pmachiraju, 11-01-2023, 04:46 AM
        8 responses
        151 views
        0 likes
        Last Post rehmans
        by rehmans
         
        Started by mattbsea, Today, 05:44 PM
        0 responses
        6 views
        0 likes
        Last Post mattbsea  
        Working...
        X