Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Serialization error

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

    Serialization error

    FYI

    I just got a weird error when closing my workspace.
    (see attached .png)

    I was using the standard Ninja 'Volume UpdDown" indicator on a chart.
    Everything worked fine all afternoon....until I closed the workspace, at which point I got this error message...

    "Indicator 'NinjaTrader.Indicator.VolumeUpDown' could not be serialized.
    Please refer help for more information on serializing indicators."

    Not at all sure why NT7 didn't like it's own indicator...

    Not a serious problem for me....but thought you might like to know.
    Attached Files

    #2
    Does your indicator use custom colors? You would need to serialize those parameters.

    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Nope.....I loaded the indicator straight from NT7.....just like it came.
      (I didn't modify color, bar size, or panel....let it run 'stock')


      Also....in case I wasn't clear before, this is not one of my indicators....


      // Copyright (C) 2007, NinjaTrader LLC <www.ninjatrader.com>.
      // NinjaTrader reserves the right to modify or overwrite this NinjaScript component with each release.


      This is the 'standard version' that came with NT7.
      Last edited by photog53; 08-27-2010, 02:25 PM.

      Comment


        #4
        Can you please provide the workspace you are using along with the NT7 version you are using? Thank you.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          XmlIgnore() in Bollinger Indicator

          If code an indicator which calls the Bollinger average via

          Code:
           
          int numStdDev = 2;
          int period = 14;
          double average = Bollinger(numStdDev, period).Upper[0];
          and then want to export it, I get an error message. The problem is the code line

          Code:
           
          [XmlIgnore()]
          that preceeds the DataSeries of the Bollinger indicators in the Properties region. If I delete these lines from the Bollinger indicator it works.

          What is the benefit of setting [XmlIgnore()] ?

          Comment


            #6
            [XmlIgnore()] is a C# concept. Please see here for more information: http://msdn.microsoft.com/en-us/libr...xmlignore.aspx
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              My question was, why you put it in the NT Bollinger indicator code?

              Because of this the NT Bollinger indicator cannot be correctly called by other indicators!

              Comment


                #8
                Let us take a step back. What exactly are you trying? What do you mean by "export it" and what error message are you referring to? Thanks.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  (1) If I call Bollinger within another indicator (for example Bollinger(1,period).Midline[0]) that works fine.

                  (2) If I want to export the new indicator via NT -> error message, could not be exported, please check your logs. The logs are empty.

                  The reason for the error message is that XmlIgnore() command in the Bollinger Indicator! That command prevents any indicator which is calling Bollinger from being exported properly.

                  So I modified the Bollinger indicator by deleting the offensive code, and now any indicator calling it, could happily be exported.


                  Originally posted by NinjaTrader_Josh View Post
                  Let us take a step back. What exactly are you trying? What do you mean by "export it" and what error message are you referring to? Thanks.

                  Comment


                    #10
                    NT 7.0.0.20

                    Here is a specific example.

                    The indicator example 1 calls BollingerIND (which is the Bollinger indicator with the XmlIgnore() commands removed). It can be easily exported.

                    The indicator example 2 is identical with example 1, but calls Bollinger instead of BollignerIND. It cannot be exported, but the error message below is shown. The error code is CS0103: "The name "Bollinger" does not exist in the current context (see HelpguideV6 ??? for export problems).

                    This problem is created by the XmlIgnore() code in the Bollinger indicator, as the DataSeries cannot be exposed correctly with this code. So you should remove that offending code.

                    Attachments Example 1 (exported) and Example 2 (cs file that cannot be exported by NinjaTrader)
                    Attached Files

                    Comment


                      #11
                      Harry,

                      Please see the link provided in the log message. It outlines steps you should do when such a scenario is hit.

                      Expand the .NET Referencing section here: http://www.ninjatrader.com/support/h...ort%2Bproblems
                      You should not be removing XmlIgnore(), but instead should simply include the System Indicator into your export.
                      Josh P.NinjaTrader Customer Service

                      Comment


                        #12
                        Originally posted by Harry View Post

                        What is the benefit of setting [XmlIgnore()] ?
                        The benefit to using [XmlIgnore()] before a property is that it prevents that property from being serialized, which means that the property's value is not saved when you save a chart template or a workspace.

                        Thus [XmlIgnore()] is used before DataSeries properties since a DataSeries never gets saved in a template/workspace. It is also used for Color and Pen properties, etc. since these require special handlings (converting color names and pen attributes to strings or numbers) to serialize the files for templates & workspaces -- the code for serializing colors is all over the place in various indicators and for pen serialization, see http://www.ninjatrader.com/support/f...ad.php?t=22724.

                        Comment


                          #13
                          Originally posted by KBJ View Post
                          The benefit to using [XmlIgnore()] before a property is that it prevents that property from being serialized, which means that the property's value is not saved when you save a chart template or a workspace.

                          Thus [XmlIgnore()] is used before DataSeries properties since a DataSeries never gets saved in a template/workspace. It is also used for Color and Pen properties, etc. since these require special handlings (converting color names and pen attributes to strings or numbers) to serialize the files for templates & workspaces -- the code for serializing colors is all over the place in various indicators and for pen serialization, see http://www.ninjatrader.com/support/f...ad.php?t=22724.

                          Thanks for the comment. I have serialized all sorts of colours, dates, time spans and sometimes I have forgotten to remove the [XmlIgnore()] which has caused problems, as the serialized values were not saved as part of the workspace. I understand that you want to save some of the parameters such as a period of a moving average with the workspace, and that obviously you do not want to save the values of a dataseries, which is based on price.

                          If I want to export an indicator using the SMA , SMA is automatically included with the exported file. The [XmlIgnore()] prevents NinjaTrader from including the called system indicator with an exported file. So you have to include it manually. Strange.

                          Comment


                            #14
                            Harry,

                            Basically this is what is happening.

                            On certain PC setups for various reasons related to the combination regional settings of the computer and the settings of the .NET install the .NET referencing simply does not work to pick up some of the system indicators. When such a scenario occurs the way around this is to manually add the system indicator. The help guide instructions were written specifically for the scenario you are running into and in fact is the exact reason we added the ability to manually add system indicators in the export which was not possible in 6.5.
                            Josh P.NinjaTrader Customer Service

                            Comment


                              #15
                              Thanks Josh.

                              confirm it works, when manually adding the references.

                              Was just astonished that the XmlIgnore() was the reason that references were not being picked up automatically.

                              Originally posted by NinjaTrader_Josh View Post
                              Harry,

                              Basically this is what is happening.

                              On certain PC setups for various reasons related to the combination regional settings of the computer and the settings of the .NET install the .NET referencing simply does not work to pick up some of the system indicators. When such a scenario occurs the way around this is to manually add the system indicator. The help guide instructions were written specifically for the scenario you are running into and in fact is the exact reason we added the ability to manually add system indicators in the export which was not possible in 6.5.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Perr0Grande, Today, 08:16 PM
                              0 responses
                              2 views
                              0 likes
                              Last Post Perr0Grande  
                              Started by elderan, Today, 08:03 PM
                              0 responses
                              5 views
                              0 likes
                              Last Post elderan
                              by elderan
                               
                              Started by algospoke, Today, 06:40 PM
                              0 responses
                              10 views
                              0 likes
                              Last Post algospoke  
                              Started by maybeimnotrader, Today, 05:46 PM
                              0 responses
                              11 views
                              0 likes
                              Last Post maybeimnotrader  
                              Started by quantismo, Today, 05:13 PM
                              0 responses
                              7 views
                              0 likes
                              Last Post quantismo  
                              Working...
                              X