Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

XML Serializing error

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

    XML Serializing error

    I have a strategy xxx which runs without error in the strategy analyser, but which generates an error when I try to paper trade it in "Control Centre -> Strategies Tab". The error message pops up when I press the start button (after adding xxx as a new strategy) and again when I click on stop button.

    But the paper trading appears to proceed correctly.

    The message is:
    Fail to execute DB job 'StrategyUpdatejob': there was an error generating the XML document: A circular reference was detected while serializing an object of type NinjaTrader.Strategy.xxx
    Does anybody know how I can stop the error message or even what it means? I had a google search, but it is all advanced C# that I don't really understand.

    Thanks,
    Matthew.

    #2
    You needed to contact the author of your strategy in order to get this resolved. If you are the author then you needed to isolate the cause of trouble. XML serialization is a standard .NET technology which comes with some restrictions. I suggest consulting the Microsoft docs and/or searching this for "serialization".

    Comment


      #3
      Is XML serialization required by NinjaTrader? Is there a way to turn it off? If so then does any body know how (probably add something to the "public xxx : Strategy" declaration line?)?

      If it is required then how can I make my class serializable? [I know the response suggested I look at the docs, does anybody know where I should start?].

      Thanks,
      Matthew.

      Comment


        #4
        try adding this attribute

        [Serializable]
        publicclass MyStrategyClassOrwhatSoEver {
        ...
        }

        then the compiler will tell you more...


        regards
        andreas

        www.zweisteintrading.eu





        Comment


          #5
          Thanks for the suggestion. It does not have any effect though :-(. It is not a compilation error it is a run-time error when I "start" or "stop" paper trading.

          Can I tell it to not try to serialize my class?

          Comment


            #6
            Originally posted by mtthwbrnd View Post
            Thanks for the suggestion. It does not have any effect though :-(. It is not a compilation error it is a run-time error when I "start" or "stop" paper trading.

            Can I tell it to not try to serialize my class?
            Any strategy needs to be serializable as it needed to be persisted. There is no way around.

            Comment


              #7
              Thanks for the hints :-).

              I have got it working now by changing a member of the class to static, it worked out well for what I am doing because fortunately that member is the same for all instances of that class (i.e. I should have made it static in the first place) ... happy days :-)

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              648 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              369 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              108 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              572 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              574 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X