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 Generating XML

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

    Problem Generating XML

    Guys,

    I am seeing a problem with even simple indicators preventing them from saving in templates and workspaces -- i.e., failing to save in XML files. I have attached a sample code here that illustrates the problem, both the source code and the compiled zip file. The attached code has one variable and no other significant commands, and that variable is a brush color. An attempt to save a template with this on chart produces the log error

    "Could not save indicator 'XMLTestIndicator.' There was an error generating the XML document."

    The error should be easy to repeat if you install the compiled code attached here. I am seeing the same problem in 7 out of 8 indicators converted from NT7 to NT8. They compile and run fine in NT8, but don't save in templates or workspaces. The one indicator which does correctly save to XML also has brush color inputs that are written exactly as they are here, so I can't confirm that the problem is saving brush information. I'm still looking for a cause or a work-around. Any help would be appreciated...

    Thanks again,

    Light
    Attached Files

    #2
    You need an XMLIgnore Attribute on the Brush property. (excludes it from serialization).
    And a Browsable(false) on the Serialized Property (excludes it from the indicator dialog box)

    Here's an example from one of my indicators:

    Code:
    		[Display(Name = "Bullish Line Colour", Description = "Bullish Line Colour", Order = 1, GroupName = "Visual")]
    		[XmlIgnore]
    		public Brush BullishLineColour
    		{
    			get;
    			set;
    		}
    
    		[Browsable(false)]
    		public string BullishLineColourSerializable
    		{
    			get
    			{
    				return Serialize.BrushToString(this.BullishLineColour);
    			}
    			set
    			{
    				this.BullishLineColour = Serialize.StringToBrush(value);
    			}
    		}

    Comment


      #3
      Missing XMLIgnore

      Thanks for the tip reach4thelasers. The "[XMLIgnore]" command was the missing element. Odd behavior since one indicator with a great many brush variables, all with no [XmlIgnore] command included, worked fine. I'll include that command with all of my color variables in NT8. Thanks again for the help!

      Light

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by GLFX005, Today, 03:23 AM
      0 responses
      2 views
      0 likes
      Last Post GLFX005
      by GLFX005
       
      Started by XXtrader, Yesterday, 11:30 PM
      2 responses
      11 views
      0 likes
      Last Post XXtrader  
      Started by Waxavi, Today, 02:10 AM
      0 responses
      7 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Started by TradeForge, Today, 02:09 AM
      0 responses
      14 views
      0 likes
      Last Post TradeForge  
      Started by Waxavi, Today, 02:00 AM
      0 responses
      3 views
      0 likes
      Last Post Waxavi
      by Waxavi
       
      Working...
      X