Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Serializing Indicators

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

    Serializing Indicators

    Every time I try and save this indicator as a default template . .. it gives me an error
    message "Indicator RSqueeze could not be serialized" ... "please see Serializing Indicators" .. The only thing I see in Serializing Indicators .. is something to do with Color plots, but, it looks correct in the code? Can anyone offer any suggestions?

    (indicator file should be attached)
    Attached Files

    #2
    Originally posted by dinoman View Post
    Every time I try and save this indicator as a default template . .. it gives me an error
    message "Indicator RSqueeze could not be serialized" ... "please see Serializing Indicators" .. The only thing I see in Serializing Indicators .. is something to do with Color plots, but, it looks correct in the code? Can anyone offer any suggestions?

    (indicator file should be attached)
    You have [XmlIgnore()] on every parameter. The code is doing what you asked it to do: ignoring all your parameters when doing the xml serialization.

    Comment


      #3
      Koganam, Thank you for your quick reply!
      For a novice programmer the obvious question arises....
      How do I determine which statements need an XmlIgnore and which don't?
      Originally the code was with just a few XmlIgnore statements (the ones I added are marked with a comment XYZ on the preceeding line). I was trying to resolve the problem with adding additional XmlIgnore statements. That didn't work, so I'm lost as to how to place the XmlIgnore statements or even if that will fix my problem.

      Comment


        #4
        Originally posted by dinoman View Post
        Koganam, Thank you for your quick reply!
        For a novice programmer the obvious question arises....
        How do I determine which statements need an XmlIgnore and which don't?
        Originally the code was with just a few XmlIgnore statements (the ones I added are marked with a comment XYZ on the preceeding line). I was trying to resolve the problem with adding additional XmlIgnore statements. That didn't work, so I'm lost as to how to place the XmlIgnore statements or even if that will fix my problem.
        Here is a model for serializing color.
        Code:
                [Description("Color of the plot if the value of the CCI is rising.")]
                [Category("Colors")]
                [Gui.Design.DisplayName("Rising Plot Color")]
                public Color RisingPlotColor
                {
                    get { return this._colorRisingPlotColor; }
                    set { this._colorRisingPlotColor = value; }
                }
         
          [Browsable(false)]
          public string RisingPlotColorSerialize
          {
          get { return NinjaTrader.Gui.Design.SerializableColor.ToString(this._colorRisingPlotColor); }
          set { this._colorRisingPlotColor = NinjaTrader.Gui.Design.SerializableColor.FromString(value); }
          }
        You should use [XmlIgnore] only on types that .NET does not natively serialize, and for which you are writing the serializing code. It is used on Plots because NT has written the serialization code as part of its framework.

        As a general rule, you are unlikely to need XmlIgnore, until you start trying to serialize Fonts and TimeSpans and such. Primitive types will never need that directive, at least not currently.

        Comment

        Latest Posts

        Collapse

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