Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

can't save my templates

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

    can't save my templates

    Hi NT support,

    I've just re-coded some personal indicators, which have compiled fine in NT7b21. However after I load them onto a chart and try to save the template, I get the following message:

    Indicator 'Ninjatrader.Indicator.[name]' could not be serialized. Please refer help for more information on serializing indicators.

    I can't find any further info in the help file, so any suggestions?

    cheers,
    Vince

    #2
    Vince, are you using any user defined colors as inputs? Those need to be serialized properly to make them 'saveable' - http://www.ninjatrader.com/support/f...ead.php?t=4977

    Comment


      #3
      Hi Bertrand,

      All color inputs already have [XmlIgnore()], only other variables are 2x bool, 1x int and 1x double.

      Cheers,
      Vince

      Please refer below:

      #region Properties
      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public DataSeries Diff
      {
      get { return Values[0]; }
      }

      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public DataSeries UpperStrong
      {
      get { return Values[1]; }
      }
      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public DataSeries UpperWeak
      {
      get { return Values[2]; }
      }
      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public DataSeries LowerStrong
      {
      get { return Values[3]; }
      }
      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public DataSeries LowerWeak
      {
      get { return Values[4]; }
      }
      [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove
      [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
      public DataSeries Middle
      {
      get { return Values[5]; }
      }

      [Description("")]
      [Category("Parameters")]
      public int Period
      {
      get { return period; }
      set { period = Math.Max(1, value); }
      }

      [Description("")]
      [Category("Parameters")]
      public double StdDev
      {
      get { return stdDev; }
      set { stdDev = Math.Max(1, value); }
      }

      [Description("")]
      [Category("Parameters")]
      public bool Background
      {
      get { return background; }
      set { background = value; }
      }

      [Description("")]
      [Category("Parameters")]
      public bool BarOutline
      {
      get { return barOutline; }
      set { barOutline = value; }
      }
      #endregion

      Comment


        #4
        Vince, those should not need extra serialization, for NT7 please use GridCateroy instead of Category, recompile and then retry.

        Thanks

        Comment


          #5
          Originally posted by vincetc View Post
          Hi NT support,

          I've just re-coded some personal indicators, which have compiled fine in NT7b21. However after I load them onto a chart and try to save the template, I get the following message:

          Indicator 'Ninjatrader.Indicator.[name]' could not be serialized. Please refer help for more information on serializing indicators.

          I can't find any further info in the help file, so any suggestions?

          cheers,
          Vince
          Hi Vince,

          I've had similar problems. Got around them by simply right clicking on the chart and selecting reloading NinjaScript.

          Then I was able to save the template.

          RJay
          RJay
          NinjaTrader Ecosystem Vendor - Innovative Trading Solutions

          Comment


            #6
            Hi RJay and Bertrand,

            Thanks for the replies, I've tried the suggested solutions but neither has fixed my issue.

            After some bumbling around, I have found the source of the problem but opened another can of worms.

            This indicator (among other things) will produce two values (int and double) which are then assigned to DataSeries arrays.

            The problem is after I recoded, if I try to access these arrays from a strategy (or even another indicator), the values are not accessible (get a '0' in output display)

            Therefore I forced access to the arrays by defining them as "public DataSeries [name]", which allows the strategy to access these values. (didn't think this would be an issue)

            The indi compiles fine (no errors) and output window properly displays the values in the arrays, the only issue is that after I apply this indicator onto a template, I can't save the template and get the NT message about the indi not serialized.

            If I remove the 'public' when defining the DataSeries and try to compile I get"[indicator name] inaccessable due to its protection level".

            Any suggestions are much appreciated.

            Cheers, Vince

            Comment


              #7
              Vince, thanks for testing and clarifying - would you mind sending me the indicator giving you issues to support at ninjatrader dot com and my Attn so I can look into?

              Thanks

              Comment


                #8
                Hi Bertrand,

                Thanks for the offer, I have found a work around (using better indicator version control). and have access to the values and can save the template.

                The indi part of an live adaptive trading system, so reluctant to release,

                The source of the problem, is that when I define these 2 specific arrays, the compiler protects the stored values from any "members" accessing the values. (they aren't the only defined DataSeries within indicator). For some reason the compiler decides that these specific arrays need to be protected

                Any suggestions or places I can go research the proper technical solution would be appreciated.

                Again thanks for the assistance.

                Cheers, Vince

                Comment


                  #9
                  I can for sure understand Vince - please clarify - are you talking about dataSeries here or an Array / ArrayList?

                  Plots and the associated series are auto exposed for access to values, regular 'calculation' only dataSeries need to be exposed specifically with this technique -

                  Comment


                    #10
                    Sorry, me bad. I'm talking DataSeries.

                    Had a quick look at the sample code, interesting possibilities to improve the efficency of my coding, but not suitable for this indi.

                    The indi doesn't need to plot, after it analysis' it assigns an integar value (to identify the different possible states) and double value to each of the DataSeries, which is inturn accessed by other indi's and/or strat for further analysis or order management.

                    I just found this line in my trace file from last night, it may help in identifying what I did wrong.

                    2010-09-23 02:40:02:581 Gui.Chart.ChartControl.SaveToXml: indicator=NinjaTrader.Indicator.TCP_MAVA_USDX_Ver4 1: System.InvalidOperationException: There was an error reflecting type 'NinjaTrader.Indicator.TCP_MAVA_USDX_Ver41'. ---> System.InvalidOperationException: Cannot serialize member 'NinjaTrader.Indicator.TCP_MAVA_USDX_Ver41.MAVASig nal' of type 'NinjaTrader.Data.DataSeries', see inner exception for more details. ---> System.InvalidOperationException: NinjaTrader.Data.DataSeries cannot be serialized because it does not have a parameterless constructor.
                    --- End of inner exception stack trace ---

                    Cheers,
                    Vince

                    Comment


                      #11
                      Vince, thanks for the clarification - could you please direct your trace / logs to me via the Help > Mail to Support feature so I can review them looking into the trace excerpt you spotted?

                      Thanks

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      596 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      343 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      103 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      556 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      554 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X