Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

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

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

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

    Hi,

    I have an issue with an indicator where I cannot store it on a chart, because NT will not save the settings. In the past, I've realized I needed to serialize something NT could not handle, but this one is so simple and I am obviously blindly missing something.

    I get this error

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

    I have tried 'reset' on the template, and it has then saved. But, change a few settings and I get back to this again, which means on NT restart, indicator is gone.

    This is my settings code, and I think this is really the only place this can be the problem? Can you see any issue there? Anywhere else for me to check?

    Thanks.


    Code:
        #region Properties
    
            [NinjaScriptProperty]
            [Display(Name = "resetOnEachBar", GroupName = "NinjaScriptParameters", Order = 0)]
            public bool resetOnEachBar
            { get; set; }
    
            [NinjaScriptProperty]
            [Display(Name = "useTickSeries", GroupName = "NinjaScriptParameters", Order = 1)]
            public bool useTickSeries
            { get; set; }        
    
    //        [NinjaScriptProperty]
    //        [Range(0, int.MaxValue)]
    //        [Display(Name = "Minimum volume", GroupName = "NinjaScriptParameters", Order = 1)]
    //        public double minvol
    //        { get; set; }    
    
            [NinjaScriptProperty]
            [Display(Name = "show all POCVOLs", GroupName = "NinjaScriptParameters", Order = 3)]
            public bool showallpocs
            { get; set; }    
    
            [NinjaScriptProperty]
            [Display(Name = "show text", GroupName = "NinjaScriptParameters", Order = 4)]
            public bool showText
            { get; set; }        
    
            [NinjaScriptProperty]
            [Display(Name = "VolMultiplier1", GroupName = "NinjaScriptParameters", Order = 5)]
            public double VolMultiplier1
            { get; set; }    
    
            [NinjaScriptProperty]
            [Display(Name = "VolMultiplier2", GroupName = "NinjaScriptParameters", Order = 6)]
            public double VolMultiplier2
            { get; set; }        
    
            [NinjaScriptProperty]
            [Display(Name = "VolMultiplier3", GroupName = "NinjaScriptParameters", Order = 7)]
            public double VolMultiplier3
            { get; set; }        
    
            [NinjaScriptProperty]
            [Display(Name = "Font Size", GroupName = "NinjaScriptParameters", Order = 8)]
            public int fSize
            { get; set; }            
    
            [NinjaScriptProperty]
            [Display(Name = "Enable Alerts", GroupName = "Alerts", Order = 0)]
            public bool enableAlerts
            { get; set; }    
    
            [Range(0, 19)]
            [Display(Name="shared_indicator_id", Order=1, GroupName="Algo", Description="UNIQUE amoungst instrument indicator id")]
            public int shared_indicator_id
            { get; set; }    
    
            [Range(0, 19)]
            [Display(Name="shared_instrument_id", Order=2, GroupName="Algo", Description="Instrument id")]
            public int shared_instrument_id
            { get; set; }            
    
            [Browsable(false)]
            [XmlIgnore]
            public Series<double> PltPOC
            {
                get { return Values[0]; }
            }        
    
    
            #endregion

    #2
    Hello pjsmith, thank you for your post.

    I am not getting a save error when I load these properties. Perhaps a different indicator or strategy is throwing this error. Try the indicator in a new workspace and see if it saves on one chart. Typically only Color and Brush objects are the only ones that need to be serialized as described on this page. Searching your scripts for these type of objects could help find the problem script.

    I look forward to hearing of your results.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hello pjsmith, thank you for your post.

      I am not getting a save error when I load these properties. Perhaps a different indicator or strategy is throwing this error. Try the indicator in a new workspace and see if it saves on one chart. Typically only Color and Brush objects are the only ones that need to be serialized as described on this page. Searching your scripts for these type of objects could help find the problem script.

      I look forward to hearing of your results.
      Hi - Thanks, and yes, that's what I though and have come across in the past. I have in fact already tried this before posting. A simple chart, no other indicators, once I start changing things, It no longer saves. It's confusing me! I CAN get it to save, if I go to the indicator templates and click 'reset'. Then it will save, but as soon as I start changing things, it does not again.

      There is nothing else saved in the XML, except these properties? btw - It would be real helpful if the log message stated what variable was errored on, rather than just that is could not save the XML - I see no easy way to debug it... I have made some changes to the properties list. Is it possible there is some data stuck in a file somewhere that is causing it?

      Thanks.

      Comment


        #4
        Hello pjsmith, thanks for your reply.

        Unless your script is making some other file this would not be the cause. If you could reduce the script as much as possible to where is still re-creates the problem I would be happy to test it on my PC, but I am guessing I will not get the issue since I already tested your parameters. You can try to make a new user folder if all else fails, rename the "NinjaTrader 8" folder in the documents then run the installer from the link below:

        NinjaTrader is a futures trading platform that delivers integrated multi-device trading. Discover our best platform to trade futures for active futures traders.


        After a new user folder has been created, move over all custom scripts within Documents\NinjaTrader 8\bin\Custom also move over your Templates and Workspaces folder, as well as your Config file.

        Please let me know if I can assist further.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Still struggling with this. The only thing I have been able to identify is that the XMNL is saved fine with onbarupdate set to On Bar Close. The moment I change it to On each Tick, I get the failed to save xml error. I note I did not have a Calculate = Calculate.OnEachTick; in set state defaults, but I have now added one. It still does not solve the issue. Bit confused as to why it will save onbarclose, and not set to oneachtick!

          Comment


            #6
            Hello pjsmith, thanks for your reply.

            I am unable to reproduce this problem on my installation. I would need you to provide a test script that will reproduce the issue so we can move forward.

            I look forward to hearing from you.
            Chris L.NinjaTrader Customer Service

            Comment


              #7
              SOLVED.

              In the end, I had inadvertently declared an internally used brush in the top of the document (not in properties) as 'public', when it should have been private.

              private Brush AreaBrush; vs public Brush AreaBrush;

              Doh!

              Posting solution in case helps anyone else.

              Comment


                #8
                Originally posted by pjsmith View Post
                SOLVED.

                In the end, I had inadvertently declared an internally used brush in the top of the document (not in properties) as 'public', when it should have been private.

                private Brush AreaBrush; vs public Brush AreaBrush;

                Doh!

                Posting solution in case helps anyone else.
                pjsmith Hi,

                I have been struggling with the same issue (Indicator settings not saved in a template) for a couple of hours until I came across this thread. I used your solution "private Brush AreaBrush" and did not work. Finally I added [XmlIgnore] to parameters for "public Brush AreaBrush" and the issue was resolved. I have had this issue before but could not remember that missing the "XmlIgnore]" was always the culprit.

                Cheers!

                Comment


                  #9
                  Originally posted by aligator View Post

                  pjsmith Hi,

                  I have been struggling with the same issue (Indicator settings not saved in a template) for a couple of hours until I came across this thread. I used your solution "private Brush AreaBrush" and did not work. Finally I added [XmlIgnore] to parameters for "public Brush AreaBrush" and the issue was resolved. I have had this issue before but could not remember that missing the "XmlIgnore]" was always the culprit.

                  Cheers!
                  Thank you Aligator - experienced the same thing.
                  Adding [XmlIgnore()] above the [Display.....] attribute in region PROPERTIES made all the difference!

                  Code:
                  [XmlIgnore()]
                  [Display(Name = "Up Brush", GroupName = "Colors", Order = 1)]
                  public Brush UpBrush
                  { get; set; }
                  
                  
                  // Serialize our Color object
                  [Browsable(false)]
                  public string UpBrushSerialize
                  {
                  get { return Serialize.BrushToString(UpBrush); }
                  set { UpBrush = Serialize.StringToBrush(value); }
                  }
                  ​
                  Thank you sir!

                  Comment


                    #10
                    Originally posted by aligator View Post
                    Finally I added [XmlIgnore] to parameters for "public Brush AreaBrush" and the issue was resolved.
                    Awesome! Many thanks.

                    Comment


                      #11
                      spent over an hour trying everything i could think of and then i found us gathering here to repair and patch up wounds...
                      thanks to all you intrepid souls that won't accept good enough and venture out to make a better mouse trap...
                      thanks for the posts !!!!
                      missing [XMLIgnore] on a public Brush in parameters... got fixed up and am back on the road...
                      Santa Feeee

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Mestor, 03-10-2023, 01:50 AM
                      16 responses
                      388 views
                      0 likes
                      Last Post z.franck  
                      Started by rtwave, 04-12-2024, 09:30 AM
                      4 responses
                      31 views
                      0 likes
                      Last Post rtwave
                      by rtwave
                       
                      Started by yertle, Yesterday, 08:38 AM
                      7 responses
                      29 views
                      0 likes
                      Last Post yertle
                      by yertle
                       
                      Started by bmartz, 03-12-2024, 06:12 AM
                      2 responses
                      22 views
                      0 likes
                      Last Post bmartz
                      by bmartz
                       
                      Started by funk10101, Today, 12:02 AM
                      0 responses
                      7 views
                      0 likes
                      Last Post funk10101  
                      Working...
                      X