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:	476
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 RubenCazorla, Today, 09:07 AM
              0 responses
              1 view
              0 likes
              Last Post RubenCazorla  
              Started by BarzTrading, Today, 07:25 AM
              2 responses
              28 views
              1 like
              Last Post BarzTrading  
              Started by devatechnologies, 04-14-2024, 02:58 PM
              3 responses
              20 views
              0 likes
              Last Post NinjaTrader_BrandonH  
              Started by tkaboris, Today, 08:01 AM
              0 responses
              6 views
              0 likes
              Last Post tkaboris  
              Started by EB Worx, 04-04-2023, 02:34 AM
              7 responses
              165 views
              0 likes
              Last Post VFI26
              by VFI26
               
              Working...
              X