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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      160 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      308 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      245 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      349 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      179 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X