Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

NT8-B9 Indicator preset save error

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

    NT8-B9 Indicator preset save error

    Hello,

    I'm getting the following error when trying to save my presets on an indicator:

    Unhandled exception: There was an error generating the XML document.

    I can save presets for other indicators, but not the one I've just finished. The indicator itself compiles and runs fine and it's settings are preserved as long as I don't remove it from my chart.

    Let me know what to do next to help troubleshoot this.

    Thanks!
    daqu40
    NinjaTrader Ecosystem Vendor - QTradez

    #2
    Hello,

    When NinjaTrader tries to save a template or save an indicator to the workspace it attempts to 'serialize' or plainly put in english take the values of all public properties and write them to a text file so that it could be saved on the hard drive and loaded later.

    Most standard .net types such as 'strings', 'ints', etc all will 'serialize' without an issue. However more complex types might need to have custom serializers writen or an attribute added to the property to tell NT to ignore saving this to the disk.

    Can you do a copy and past of a few of the properties from this indicator in the forum and I could provide further guidance on what could be giving us the trouble by being able to look at what public properties you have.

    Comment


      #3
      Thanks for the quick reply Brett,

      A few of the properties are below. There is a Brush property that I'm guessing is the culprit. I have a total of six of these to work with. Everything else is standard int, double or string.

      // [Description("KSqueeze ZeroLine AlertColor")]
      // [Category("KSqueeze")]
      // [Gui.Design.DisplayName("KSqueeze AlertColor")]
      [Display(ResourceType = typeof(Custom.Resource), Name = "KSqueeze AlertColor", GroupName = "KSqueeze"
      , Description = "KSqueeze ZeroLine AlertColor", Order = 3)]
      public Brush Alertcolor
      {
      get { return _alertcolor; }
      set { _alertcolor = value; }
      }

      [Browsable(false)]
      public string AlertcolorSerialize
      { get; set; }

      // [Description("KSqueeze ZeroLine NormalColor")]
      // [Category("KSqueeze")]
      // [Gui.Design.DisplayName("KSqueeze NormalColor")]
      [Display(ResourceType = typeof(Custom.Resource), Name = "KSqueeze NormalColor", GroupName = "KSqueeze"
      , Description = "KSqueeze ZeroLine NormalColor", Order = 4)]
      public Brush Normalcolor
      {
      get { return _normalcolor; }
      set { _normalcolor = value; }
      }

      [Browsable(false)]
      public string NormalcolorSerialize
      { get; set; }
      daqu40
      NinjaTrader Ecosystem Vendor - QTradez

      Comment


        #4
        No problem.

        Yes likely the brush then. Please see this documentation page:



        Specifically the section "Saving a Brush as a user defined property (Serialization)".

        Let me know if that is not clear and I needed to give further information.

        Comment


          #5
          Got it Brett,

          As you can see this is already half way there. I just need to put the XMLIgnore on the Brushes.

          I'll post again when I've confirmed this works tomorrow.
          daqu40
          NinjaTrader Ecosystem Vendor - QTradez

          Comment


            #6
            The article was all I needed. Preset is now functioning as expected.

            Thanks!
            daqu40
            NinjaTrader Ecosystem Vendor - QTradez

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Waxavi, Today, 02:10 AM
            1 response
            17 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by Kaledus, Today, 01:29 PM
            5 responses
            13 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by Waxavi, Today, 02:00 AM
            1 response
            12 views
            0 likes
            Last Post NinjaTrader_LuisH  
            Started by alifarahani, Today, 09:40 AM
            5 responses
            23 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Started by gentlebenthebear, Today, 01:30 AM
            3 responses
            17 views
            0 likes
            Last Post NinjaTrader_Jesse  
            Working...
            X