Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 cre8able, 02-11-2023, 05:43 PM
        3 responses
        231 views
        0 likes
        Last Post rhubear
        by rhubear
         
        Started by frslvr, 04-11-2024, 07:26 AM
        8 responses
        111 views
        1 like
        Last Post NinjaTrader_BrandonH  
        Started by stafe, 04-15-2024, 08:34 PM
        10 responses
        44 views
        0 likes
        Last Post stafe
        by stafe
         
        Started by rocketman7, Today, 09:41 AM
        3 responses
        8 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by traderqz, Today, 09:44 AM
        2 responses
        5 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Working...
        X