Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

{NinjaScript} - NT8 Get Order List.

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

    {NinjaScript} - NT8 Get Order List.

    Hello,
    I need to acces an array (or list) of Orders created to iterate all orders submitted and make some action.
    It doesn't matter if they were full or not.
    Could you give me some sample code?
    I picture something like that:

    for( int i = 0 ; i < orders.Count ; i ++)
    if(orders[i].Name== "order1234")
    DoSomething();

    thank you so much




    #2
    Doesn't matter if they are FILLED*

    Comment


      #3
      Hello fscabrera03,

      Are you wanting all orders to an account or just orders submitted by a NinjaScript Strategy?

      In a NinjaScript Strategy you could make your own List<Order> and .Add() each order to the list in OnOrderUpdate().


      NinjaTrader provides a trades collection which contains the orders, but only after the trade is closed.
      ​​​​​​​https://ninjatrader.com/support/help...collection.htm
      Chelsea B.NinjaTrader Customer Service

      Comment


        #4
        Ninja does keep a list of trades prior to fill. I would prefer to access that list this is in playback.

        It may not be exposed in the object model... but it does exist.

        Click image for larger version

Name:	OrdersCollection2.png
Views:	887
Size:	53.8 KB
ID:	1205220

        Comment


          #5
          something like this may exist

          Code:
          /*
          private void GetOrders()
          {
          DateTime Starting = new DateTime(2022, 6, 14);
          DateTime Ending = new DateTime(2022, 6, 15);
          
          myOrders = GetOrdercollection();
          
          foreach (Order in NinjaTrader.Cbi.Order.DbGet(Account, Starting, Ending))
          
          NinjaTrader.Cbi.Account.LookbackDaysOrders(1);
          }
          */

          Comment


            #6
            BartMan This should be helpful: https://ninjatrader.com/support/help...rs_account.htm

            and this: https://ninjatrader.com/support/help.../nt8/order.htm

            It's always worth doing a Search on the Help. Even just browsing through it from time-to-time can turn up very useful things.

            Thanks.
            Multi-Dimensional Managed Trading
            jeronymite
            NinjaTrader Ecosystem Vendor - Mizpah Software

            Comment


              #7
              I had searched for foreach, orders and thought I had looked in that page I also look in google or duckduck go ninjascript {key phrase}

              Thanks again!

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Geovanny Suaza, 02-11-2026, 06:32 PM
              0 responses
              633 views
              0 likes
              Last Post Geovanny Suaza  
              Started by Geovanny Suaza, 02-11-2026, 05:51 PM
              0 responses
              364 views
              1 like
              Last Post Geovanny Suaza  
              Started by Mindset, 02-09-2026, 11:44 AM
              0 responses
              105 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Started by Geovanny Suaza, 02-02-2026, 12:30 PM
              0 responses
              567 views
              1 like
              Last Post Geovanny Suaza  
              Started by RFrosty, 01-28-2026, 06:49 PM
              0 responses
              568 views
              1 like
              Last Post RFrosty
              by RFrosty
               
              Working...
              X