• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

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 guvenators, Today, 05:18 PM
      1 response
      13 views
      0 likes
      Last Post NinjaTrader_ShawnB  
      Started by LANwarr1or, Today, 03:00 PM
      2 responses
      8 views
      0 likes
      Last Post LANwarr1or  
      Started by Newtrader101, Today, 02:53 PM
      2 responses
      10 views
      0 likes
      Last Post Newtrader101  
      Started by JuanPabloQuevedo, Today, 02:53 PM
      2 responses
      9 views
      0 likes
      Last Post JuanPabloQuevedo  
      Started by samir, Today, 03:16 PM
      2 responses
      14 views
      0 likes
      Last Post samir
      by samir
       
      Working...
      X