Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

IOrder and ArrayList execution error

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

    IOrder and ArrayList execution error

    Hi!
    I'm using Ninjatrader 7.0.1000.2.
    I want to store orders in ArrayList, but I'm getting an error message
    "Failed to execute DB job 'StrategyUpdateJob': Ошибка при создании документа XML.: Невозможно сериализовать NinjaTrader.Strategy.OrderProxy, т. к. он не имеет беспараметрического конструктора."
    (it's in russian) when I try to add submitted order to ArrayList. Here is sample code to get this error.
    Code:
    #region Variables
           
            public ArrayList OrderList=new ArrayList();
            
            IOrder last_buy_order=null;
            
            
            #endregion
    
            /// <summary>
            /// This method is used to configure the strategy and is called once before any strategy method is called.
            /// </summary>
            protected override void Initialize()
            {
            
                CalculateOnBarClose = false;//Calculate on every tick
                Unmanaged = true;//Using unmanaged order methods
                TraceOrders = true;
                ExitOnClose = false;
            
            
            }
                
         
    
            /// <summary>
            /// Called on each bar update event (incoming tick)
            /// </summary>
            protected override void OnBarUpdate()
            {
            if (OrderList.Count<1)
            {
            last_buy_order=SubmitOrder(0, OrderAction.Buy, OrderType.Market, 100000, 0, 0, "", "");
              try
            {
              OrderList.Add(last_buy_order);
            }
            catch(Exception e){}
            }else return;
            
                
            }
    Is there something to do with that? Is there any other way to store orders in list? I need very urgent reply, please !!!
    Thank you.

    #2
    Welcome to our forums - are you working on .NET 3.5 SP1 and latest patches from Microsoft? It would be helpful if you could sent your full trace / log files to support via the Help > Mail to Support feature, we would review them then for more info and insight.

    You can take a look at this example here, storing references for the Set() method generated orders -

    Comment


      #3
      Hi, Bertrand, thanks for your reply.
      I found the problem, it was because ArrayList was declared as "public" but not "private". After declaring ArrayList and last_buy_order as "private" error dissapeared.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      571 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      331 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
      549 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      550 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X