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

# open positions

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

    # open positions

    I am looking for a command to tell me the total number of open positions for a multi insrument strategy.
    Can you please help?

    #2
    Hello PaulZ,

    Thanks for your post.

    In a multi-Instrument strategy you can use Positions - Holds an array of Position objects that represent positions managed by the strategy. http://ninjatrader.com/support/helpG...?positions.htm

    While this won't give you directly the number of open positions, you can use a for loop to cycle through the array of Positions and test if each instrument is not flat and increment a counter variable.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Dear NinjaTrader_Paul,

      I understand your reponse, but this has number of serious drawbacks:
      - I need to run a loop through all my Positions (up to hundreds of stocks) each time I want to check the number of open trades. This eats CPU cpacity.
      - I can only check if the market position of an instrument is flat. I cannot identify if multiple orders have been placed for an instrument, so I do dot get a correct response to my question how many orders are open. Only for how many instruments orders have been placed.

      Is there really no simpler and more efficient way to know how many orders have been entered and not yet closed?
      E.g. The sytem knows the number of entries that are open at any point in time as this is checked against EntriesPerDirection before a new trade is entered. What is the parameter with which the system is tracking this and how can this parameter be captured?

      Comment


        #4
        Hello PaulZ,

        Thank you for your response.

        There would not be a means to do this without manually tracking the orders and positions with your own counter or by looping through the collection provided in NinjaScript.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Segwin, 05-07-2018, 02:15 PM
        14 responses
        1,788 views
        0 likes
        Last Post aligator  
        Started by Jimmyk, 01-26-2018, 05:19 AM
        6 responses
        837 views
        0 likes
        Last Post emuns
        by emuns
         
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,292 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        12 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        62 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X