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

deserialization problem

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

    deserialization problem

    I have an error showing the following message :

    NinjaTrader.Indicator.xxx could not be deserialized : There is an error in XML Document (1,2038).

    If I look at the trace file I don't see anything related to deserialization problem. I looked at all properties and everything seems to be fine there.

    Don't know what to do

    Where is the XML file so I can take a look at it

    Thanks
    Last edited by blar58; 03-20-2012, 12:27 PM.

    #2
    Hi blar58,

    What is the name of the script causing these errors? Do you have a simple version you could share showing the same result so we can give it a run here?
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      Ryan

      This is an indicator developed for customers.

      It is not a simple indicator more than 3,500 lines of code.

      Comment


        #4
        Hello,

        In this case please run through and do the first round of debugging. I suspect that this message is not related to the indicator and the users workspace file is simply corrupted.

        In which case a new workspace would resolve the issue let me know if it does not.

        If it does not then we would need to see what in the indicator is causing the corruption. Most likely something going on in the Properties of the indicator. Can you send us the property code your using.

        This code segment can be sent to support at ninjatrader dot com ATTN: Ryan M with this thread referenced if you do not want to post it.

        -Brett

        Comment


          #5
          Brett

          Thank you for your answer. I cannot test that right now but will do it later. As soon as I can I give you the result.

          Thank you

          Comment


            #6
            I tried a new workspace. Still same error.

            Here are my properties :

            [Description("Minimum Range Bars")]
            [Gui.Design.DisplayName("Min Bars")]
            [GridCategory("Parameters")]
            public int MinBars
            {
            get { return minBars; }
            set { minBars = value; }
            }

            [Description("Number of Ticks To Cancel Range")]
            [Gui.Design.DisplayName("Ticks To Cancel")]
            [GridCategory("Trade Parameters")]
            public int TicksToCancel
            {
            get { return ticksToCancel; }
            set { ticksToCancel = value; }
            }

            [Description("Starting Time for ranges trading")]
            [GridCategory("Trade Parameters")]
            [Gui.Design.DisplayName("Starting Time")]
            public string StartTime
            {
            get { return startTime.ToString(); }
            set { startTime = TimeSpan.Parse(value); }
            }

            [Description("Ending Time for ranges to trade")]
            [GridCategory("Trade Parameters")]
            [Gui.Design.DisplayName("Ending Time")]
            public string EndTime
            {
            get { return endTime.ToString(); }
            set { endTime = TimeSpan.Parse(value); }
            }

            [Description("How many ticks do we have to break to consider the breakout as Big Break")]
            [GridCategory("Parameters")]
            [Gui.Design.DisplayName("Big Break Ticks")]
            public int BigBreakTicks
            {
            get { return bigBreakTicks; }
            set { bigBreakTicks = value; }
            }

            [Description(" What drawing do you want to see on the screen ? ")]
            [GridCategory("Drawing Settings")]
            [Gui.Design.DisplayName("Draw Setting")]
            public drawstyle DrawSetting
            {
            get { return drawingSetting; }
            set { drawingSetting = value; }
            }

            [Description("Number of ticks below or above range extreme to display the range info.")]
            [GridCategory("Drawing Settings")]
            [Gui.Design.DisplayName("Ticks Offset to show info")]
            public int TicksOffset
            {
            get { return ticksOffset; }
            set { ticksOffset = value; }
            }

            [Description("Show Volume Bar by painting the bars based on the relation between Volume and Reference Volume")]
            [GridCategory("Drawing Settings")]
            [Gui.Design.DisplayName("Show Volume Bars")]
            public bool VolumeBars
            {
            get { return volumeBars; }
            set { volumeBars = value; }
            }

            [Description("Use alert for All Bear Range Breakout set up?")]
            [GridCategory("Alert")]
            public bool AlertAllBearRangesOn
            {
            get { return alertAllBearRangesOn; }
            set { alertAllBearRangesOn = value; }
            }

            [Description("Use alert for All Bear Range Breakout set up?")]
            [GridCategory("Alert")]
            public bool AlertAllBullRangesOn
            {
            get { return alertAllBullRangesOn; }
            set { alertAllBullRangesOn = value; }
            }

            [Description("Use alert for Big Break Bear Range Breakout set up?")]
            [GridCategory("Alert")]
            public bool AlertBigBreakBearOn
            {
            get { return alertBigBreakBearOn; }
            set { alertBigBreakBearOn = value; }
            }

            [Description("Use alert for Big Break Bull Range Breakout set up?")]
            [GridCategory("Alert")]
            public bool AlertBigBreakBullOn
            {
            get { return alertBigBreakBullOn; }
            set { alertBigBreakBullOn = value; }
            }

            [Description("Use alert for First Bear Breakout set up?")]
            [GridCategory("Alert")]
            public bool AlertFirstBearOn
            {
            get { return alertFirstBearOn; }
            set { alertFirstBearOn = value; }
            }

            [Description("Use alert for Second Bear Breakout set up?")]
            [GridCategory("Alert")]
            public bool AlertSecondBearOn
            {
            get { return alertSecondBearOn; }
            set { alertSecondBearOn = value; }
            }

            [Description("Use alert for First Bull Breakout set up?")]
            [GridCategory("Alert")]
            public bool AlertFirstBullOn
            {
            get { return alertFirstBullOn; }
            set { alertFirstBullOn = value; }
            }

            [Description("Use alert for Second Bull Breakout set up?")]
            [GridCategory("Alert")]
            public bool AlertSecondBullOn
            {
            get { return alertSecondBullOn; }
            set { alertSecondBullOn = value; }
            }

            [Description("Use audio alerts?")]
            [GridCategory("Alert")]
            public bool SoundsEnabled
            {
            get { return soundsEnabled; }
            set { soundsEnabled = value; }
            }

            [Description("Do you want to see the economic news on start up")]
            [GridCategory("News")]
            [Gui.Design.DisplayName("Show News at Startup")]
            public bool ShowNewsAuto
            {
            get { return showNewsAuto; }
            set { showNewsAuto = value; }
            }

            [Description("Do you want to download all weekly news or today news only ")]
            [GridCategory("News")]
            [Gui.Design.DisplayName("News Setting")]
            public newsSetting NewsFormat
            {
            get { return newsFormat; }
            set { newsFormat = value; }
            }

            [Description("Do you want to trade the news")]
            [GridCategory("News")]
            [Gui.Design.DisplayName("Skip news trading")]
            public bool SkipTrading
            {
            get { return skipTrading; }
            set { skipTrading = value; }
            }

            [Description("What time interval to stop trading before and after the news release")]
            [GridCategory("News")]
            [Gui.Design.DisplayName("Minutes To Stop")]
            public int MinuteToStop
            {
            get { return minutesSkip; }
            set { minutesSkip = value; }
            }

            [XmlIgnore()]
            [Description("Color for the Bullish Big Break ")]
            [GridCategory("Colors")]
            [Gui.Design.DisplayNameAttribute("Lowest Bull Big Break")]
            public Color BullBigBreakColor
            {
            get { return bullBigBreakColor; }
            set { bullBigBreakColor = value;}
            }

            /// <summary>
            /// </summary>
            [Browsable(false)]
            public string BullBigBreakColorSerialize
            {
            get { return NinjaTrader.Gui.Design.SerializableColor.ToString( bullBigBreakColor); }
            set { bullBigBreakColor = NinjaTrader.Gui.Design.SerializableColor.FromStrin g(value); }
            }

            [XmlIgnore()]
            [Description("Color for the Bearish Big Break ")]
            [GridCategory("Colors")]
            [Gui.Design.DisplayNameAttribute("Highest Bear Big Break")]
            public Color BearBigBreakColor
            {
            get { return bearBigBreakColor; }
            set { bearBigBreakColor = value;}
            }

            /// <summary>
            /// </summary>
            [Browsable(false)]
            public string BearBigBreakColorSerialize
            {
            get { return NinjaTrader.Gui.Design.SerializableColor.ToString( bearBigBreakColor); }
            set { bearBigBreakColor = NinjaTrader.Gui.Design.SerializableColor.FromStrin g(value); }
            }


            [XmlIgnore()]
            [Description("Color for the Inside Big Break ")]
            [GridCategory("Colors")]
            [Gui.Design.DisplayNameAttribute("Inside Big Break")]
            public Color InsideBigBreakColor
            {
            get { return insideBigBreakColor; }
            set { insideBigBreakColor = value;}
            }

            /// <summary>
            /// </summary>
            [Browsable(false)]
            public string InsideBigBreakColorSerialize
            {
            get { return NinjaTrader.Gui.Design.SerializableColor.ToString( insideBigBreakColor); }
            set { insideBigBreakColor = NinjaTrader.Gui.Design.SerializableColor.FromStrin g(value); }
            }

            [Description("Back Testing Style to be used. Single day backtest or multiple days backtest.")]
            [GridCategory("Trade Orders")]
            [Gui.Design.DisplayName("Back Test Style")]
            public backTestStyle BackTestingStyle
            {
            get { return backTestingStyle; }
            set { backTestingStyle= value; }
            }

            [Description("Stop Management to be used. Range or custom ticks stops.")]
            [GridCategory("Trade Orders")]
            [Gui.Design.DisplayName("Trade Management")]
            public tradeMng TradeManagement
            {
            get { return tradeManagement; }
            set { tradeManagement= value; }
            }

            [Description("What kind of Orders to be displayed")]
            [GridCategory("Trade Orders")]
            public printSetting WriteOrders
            {
            get { return writeOrders; }
            set { writeOrders= value; }
            }

            [Description("Number of days back to show orders")]
            [GridCategory("Trade Orders")]
            public int DaysBack
            {
            get { return daysBack; }
            set { daysBack= value; }
            }

            [Description("Ticks from support or resistance to used on entry price")]
            [GridCategory("Trade Orders")]
            [Gui.Design.DisplayName("Entry Ticks")]
            public int EntryTicks
            {
            get { return entryTicks; }
            set { entryTicks = value; }
            }

            [Description("Target Ticks")]
            [GridCategory("Trade Orders")]
            [Gui.Design.DisplayName("Target Ticks")]
            public int TargetTicks
            {
            get { return targetTicks; }
            set { targetTicks = value; }
            }

            [Description("Stop Ticks")]
            [GridCategory("Trade Orders")]
            [Gui.Design.DisplayName("Stop Ticks")]
            public int StopTicks
            {
            get { return stopTicks; }
            set { stopTicks = value; }
            }

            Comment


              #7
              Thanks, I looked through those but nothing stands out. Best recommendation here is to restore your code to a point when you didn't see the error, to isolate exactly what is contributing to it.

              When did it last work as you expect? When did you first see this error? Any code that was added in-between those two points in time should be commented or removed.

              We're happy to give it a run here as well, but would not be able to offer much unless we're working with only the minimum amount of code that shows the error.
              Ryan M.NinjaTrader Customer Service

              Comment


                #8
                Try putting an [XmlIgnore()] attribute on each of these properties until you find the culprit(s). i.e., on all the properties that are not declared using a primitive type.

                PHP Code:
                [Description(" What drawing do you want to see on the screen ? ")]
                [
                GridCategory("Drawing Settings")]
                [
                Gui.Design.DisplayName("Draw Setting")]
                public 
                drawstyle DrawSetting
                {
                get { return drawingSetting; }
                set drawingSetting value; }
                }
                 
                [
                Description("Do you want to download all weekly news or today news only ")]
                [
                GridCategory("News")]
                [
                Gui.Design.DisplayName("News Setting")]
                public 
                newsSetting NewsFormat
                {
                get { return newsFormat; }
                set newsFormat value; }
                }
                 
                [
                Description("Back Testing Style to be used. Single day backtest or multiple days backtest.")]
                [
                GridCategory("Trade Orders")]
                [
                Gui.Design.DisplayName("Back Test Style")]
                public 
                backTestStyle BackTestingStyle
                {
                get { return backTestingStyle; }
                set backTestingStylevalue; }
                }
                 
                [
                Description("Stop Management to be used. Range or custom ticks stops.")]
                [
                GridCategory("Trade Orders")]
                [
                Gui.Design.DisplayName("Trade Management")]
                public 
                tradeMng TradeManagement 
                {
                get { return tradeManagement; }
                set tradeManagementvalue; }
                }
                 
                [
                Description("What kind of Orders to be displayed")]
                [
                GridCategory("Trade Orders")]
                public 
                printSetting WriteOrders
                {
                get { return writeOrders; }
                set writeOrdersvalue; }

                Comment


                  #9
                  Thanks Goganam for your suggestion but I could not found any problems there.

                  I am just woundering if the problem would not come from here. I have a class named Order in a namespace and I create a new instance of that class in another class inside the NinjaTrader.Indicator namespace.

                  Here is the code :

                  Code:
                  namespace Scalping.Service.Model
                  {
                  	#region Orders
                  	
                  	public class Order 
                  	{
                  		public int Id { get; set; }
                  		public int OrderStatusCode { get; set; }
                  		public string EntryPrice {get; set; }
                  		public string StopPrice { get; set; }
                  		public string TargetPrice { get; set; }
                  		public string ExitPrice { get; set; }
                  		
                  		
                  		public OrderStatus Status
                  		{
                  			get
                  			{
                  				return (OrderStatus)this.OrderStatusCode;
                  			}
                  			set
                  			{
                  				this.OrderStatusCode = (int)value;
                  			}
                  		}
                  		
                  	}
                  
                  
                  }

                  Code:
                  public class RangeClass
                  		{	
                  			public RangeClass()
                  			{
                  				RngOrder = new Scalping.Service.Model.Order();
                  				RngOrder.OrderStatusCode=4;
                  			}
                  		
                  			public Scalping.Service.Model.Order RngOrder;
                  
                  }

                  Comment


                    #10
                    Hello,

                    Could be the case with those parameters in the custom class.

                    Can you try with a copy of the indicator that does not declare any custom classes to see this resolved.

                    -Brett

                    Comment


                      #11
                      Brett

                      It could be difficult because I am using these classes all over my 4000 line code.

                      What would be the best way to serialize and deserialize these class. I have seen a few way but I am a bit lost about which way I should take.


                      Thanks

                      Comment


                        #12
                        Hello,

                        Unfortunately that would be beyond the level of support we could provide. However what I would try is [XMLIgnore()] on your properties of your own classes just to see if this is in fact the issue, or removing the classes out to test.

                        -Brett

                        Comment


                          #13
                          I found my problem

                          I created another indicator with a new name and copied my indicator.

                          That's it. Now no more serialization problem...

                          Comment


                            #14
                            Solution

                            That's probably due to the fact that you saved the setting of the indicator as default, then after that you updated your indicator configurations which are different from prior saved as default settings.

                            All you have to do is to double click the indicator again and again until it's added to the chart, then you right click the setting and "save as default" this will solve the issue.

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by Rapine Heihei, Today, 08:19 PM
                            1 response
                            3 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by Rapine Heihei, Today, 08:25 PM
                            0 responses
                            3 views
                            0 likes
                            Last Post Rapine Heihei  
                            Started by f.saeidi, Today, 08:01 PM
                            1 response
                            4 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by Rapine Heihei, Today, 07:51 PM
                            0 responses
                            6 views
                            0 likes
                            Last Post Rapine Heihei  
                            Started by frslvr, 04-11-2024, 07:26 AM
                            5 responses
                            96 views
                            1 like
                            Last Post caryc123  
                            Working...
                            X