Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Need access in strategy script to all executions forming a position

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

    Need access in strategy script to all executions forming a position

    Actually the end requirement is that I need to access the entry order's label property when submitting the exit order.

    I figured I could do this if I could find the execution object(s) for the current position, but I only have access to very few internal objects on IPosition

    Is there a good way to do this?

    Thanks

    #2
    Is it actually true that I can't access the executions that created a position unless I collect the executions in a List<IExecution> myself in the OnExecution event?

    Comment


      #3
      You would need to track the individual executions in OnExecution(), correct - for a completed trade (entry / exit) the Trade class would help - http://www.ninjatrader-support.com/H...radeClass.html

      Comment


        #4
        That's a large hole in the API isn't it? Can you put an enhancement request onto the list for an Executions collection to be made available without us needing to program it ourselves - and also a link to the executions involved from the Position class?

        Thanks

        Comment


          #5
          Hello,

          I will put this into development, however Unmanaged orders are for advanced programmers only and is listed as such. Individual programmers that are using unmanaged orders are doing so because they want to track this information themselves and use this information in some way shape or fashion. Therefor it is expected that you track these and manage these orders in your own code and are no longer managed by NT.

          However I do understand what your saying and will submit it to development.
          BrettNinjaTrader Product Management

          Comment


            #6
            Hi Brett,

            I don't want to use unmanaged orders - all I want to do is acquire the label of the entry order so that I can use it to flag an exit order.

            It would be simple if I didn't have two different ways to enter a trade - so I don't know automatically which entry method got me into the trade. I use different labels for the different entry orders.

            If I don't have access through the Position class, then I have to apply the entry logic retrospectively in order to know at the exit point which it was.

            I've wrapped up the Enter and Exit API calls in neat little function calls but this situation is threatening to make it more and more complex.

            Comment


              #7
              adamus, thanks for the suggestions and feedback - as a hint : you could check into the Performance.Executions (unsupported) property - http://www.ninjatrader.com/support/h...erformance.htm

              Comment


                #8
                Hi Bertrand,

                I looked at it but I didn't try using it since I assumed that it would only contain closed trades, which won't help trying to find the entry to the current open position. If I had a bit more time I might test it out with some logging and stuff, but essentially when I found performance.executions and nothing else, I figured I'd get the final answer here.

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                656 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                371 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                109 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                574 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                579 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X