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 fernandobr, Today, 09:11 AM
        0 responses
        0 views
        0 likes
        Last Post fernandobr  
        Started by itrader46, Today, 09:04 AM
        1 response
        3 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by timmbbo, Today, 08:59 AM
        0 responses
        2 views
        0 likes
        Last Post timmbbo
        by timmbbo
         
        Started by bmartz, 03-12-2024, 06:12 AM
        5 responses
        33 views
        0 likes
        Last Post NinjaTrader_Zachary  
        Started by Aviram Y, Today, 05:29 AM
        4 responses
        14 views
        0 likes
        Last Post Aviram Y  
        Working...
        X