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

{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:	479
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 quantismo, 04-17-2024, 05:13 PM
              3 responses
              25 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by ScottWalsh, 04-16-2024, 04:29 PM
              7 responses
              34 views
              0 likes
              Last Post NinjaTrader_Gaby  
              Started by cls71, Today, 04:45 AM
              0 responses
              5 views
              0 likes
              Last Post cls71
              by cls71
               
              Started by mjairg, 07-20-2023, 11:57 PM
              3 responses
              214 views
              1 like
              Last Post PaulMohn  
              Started by TheWhiteDragon, 01-21-2019, 12:44 PM
              4 responses
              547 views
              0 likes
              Last Post PaulMohn  
              Working...
              X