Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Color empty on Ninjatrader restart?

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

    Color empty on Ninjatrader restart?

    All my color properties for my custom indicator are empty whenever I restart ninjatrader. I can then set them to valid colors and my indicator will reflect the new colors but if I close ninjatrader and open it again all the colors will once again be "empty" (blank). That is, the color box in my indicator properties will be "white" and there is no color name or rgb numbers next to the color box. Also when I look at the top of the chart where it displays my indicator name with all the properties it says MyIndicatorName(BAC(5 min), Color [Empty], ...)

    I do dispose of brushes and pen's in the OnTermination method if that has anything to do with it. Built-in indicators and one's by other people maintain their color on restart so it's something I'm doing.

    My color properties are defined like:


    Code:
    private Color _myColor = Color.DarkGray;
    
    [Description("Color of some lines")]
    [GridCategory("Parameters")]
    public Color MyColor
    {
    	get { return _myColor; }
    	set { _myColor = value; }
    }
    How can I get my colors to persist between restarts?
    Last edited by overflowing; 07-30-2012, 09:00 AM.

    #2
    Hello overflowing,

    Under your Properties and after you have defined the Parameters are you performing a serialize? For Example:

    Code:
    // Serialize our Color object
    [Browsable(false)]
    public string MyColorSerialize
    {
    	get { return NinjaTrader.Gui.Design.SerializableColor.ToString(_myColor); }
    	set { _myColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
    }
    For a reference sample of how to create a user definable color see the following link.
    http://www.ninjatrader.com/support/f...ead.php?t=4977

    Please let me know if I can be of further assistance.
    JCNinjaTrader Customer Service

    Comment


      #3
      Wasn't aware I needed to do that thank you

      Comment


        #4
        Is [XmlIgnore()] necessary? I see some other indicator code that uses this serialize idiom that you referenced but does not use [XmlIgnore()]. What is the impact of using it/not using it?

        Comment


          #5
          Hello overflowing,

          That line of code makes the following object savable as part of a chart template. Typically, you would not want to remove this line.

          http://www.ninjatrader.com/support/f...24&postcount=2

          Please let me know if I can be of further assistance.
          JCNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
          0 responses
          579 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
          554 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