Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Serialization Error

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

    Serialization Error

    Hello,

    I am getting an error message when I initialize a strategy file. A snapshot of the error message is attached. The basic premise of the error seems to be the serialization of a Dictionary. A similar error was also thrown regarding serialization of an ILine object.

    To give some detail, I have partitioned my strategy file into a set of partial class such that each partial class contains the logic for a particular segment of the strategy (i.e. 1 file contains historical data logic, 1 contains entry rules, etc.). I wonder if my implementation of the partial classes may be the source of the issue since I did not get this error when all the logic resided in a single strategy file.

    The error is not very informative, so I am not quite sure what the cause may be. Can someone please shed some light on the meaning of this message?

    Thank you.

    #2
    Hello,

    Thank you for the post, I do not see a image attached so I am unsure on the specific error. Based on what you have said if the problem only occurs when using partial classes, it is likely the way you have created the classes or used them.

    With the error I would be able to know more about what is happening but likely this is just the structure/syntax you are using.

    I look forward to being of further assistance.

    Comment


      #3
      Apologies. I did not preview the message and evidently the attachment was not included. Resending....
      Attached Files

      Comment


        #4
        Hello,

        Thank you for the reply.

        I am unsure based on the error, Would you be able to create a sample of the structure you are using?

        If the sample of just the structure compiles and you have no errors, this may be one of the properties you are using based on the error stating its having a problem serializing regarding a dictionary.

        I am unsure exactly what is being used in the code at this point so these would just be observations, some sort of sample that demonstrates this would likely be needed to figure out exactly the cause.

        I look forward to being of further assistance.

        Comment


          #5
          I created a very simple version of the code that is causing the issue and have attached it here. When I try to run the ibTestStrat strategy, I get the same serialization error as before.

          Thoughts?
          Attached Files

          Comment


            #6
            Hello ivb73077,

            Thanks for posting your sample code.

            When compiled there are two errors. One I could clear by removing the reference to priceactionswingpro.base in ibTestStrat.

            The other is unable to resolve BarData in ibHistDataTest. Can you add what is needed so we can compile and review?

            Thank-you.

            Comment


              #7
              Apologies. I took out too many items when I was creating the simple example.

              BarData is just an enum:

              public enum BarData {Open, High, Low, Close, Volume};

              It seems that the source of the serialization error is that I did not add:

              [XmlIgnore()]

              to the Dictionary property. I am still testing to verify that this does resolve the error. My question would be why simply adding [XmlIgnore()] would remedy the serialization error?

              Thank you

              Comment


                #8
                Hello ivb73077,

                Thanks for your reply.

                I think this post explains far better than i can: http://ninjatrader.com/support/forum...4&postcount=10

                Comment


                  #9
                  Very useful explanation. Thanks.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  607 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  353 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  105 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  560 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  561 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X