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

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 -

    BertrandNinjaTrader Customer Service

    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 merzo, 06-25-2023, 02:19 AM
      10 responses
      823 views
      1 like
      Last Post NinjaTrader_ChristopherJ  
      Started by frankthearm, Today, 09:08 AM
      5 responses
      15 views
      0 likes
      Last Post NinjaTrader_Clayton  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      43 views
      0 likes
      Last Post jeronymite  
      Started by yertle, Today, 08:38 AM
      5 responses
      16 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by adeelshahzad, Today, 03:54 AM
      3 responses
      19 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Working...
      X