Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Retrieving Post-Entry Positions Data

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

    Retrieving Post-Entry Positions Data

    Is there a method in NinjaScript to find the position...

    - entry price or the current price at the time the entry order was triggered,
    - date/time the current entry was ordered or triggered,
    - number of entry shares
    - current number of trades triggered when multiple round trips are permitted.

    #2
    borland,

    To receive this information you would have had to hold onto an IOrder reference to the entry order. Then you can access the various IOrder properties to grab the information you need.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      I see the note in the Help guide....

      Tips
      1. Not all connectivity providers support all MarketDataTypes.

      Comment


        #4
        borland,

        MarketDataType is not relevant in this case as your question is about orders. MarketDataType refers to things like L2 bid/ask data.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Actually I found that the IPosition interface provide most of what I was looking for except for the entry date....

          - AvgPrice
          - Quantity
          - Instrument
          - MarketPosition (Flat, Long, Short)

          It would be nice if the IPosition interface also included the EntryDate (hint suggestion for improvement).

          When entering a new position, I can set user variables for entryDate using OnPositionUpdate().

          protected override void OnPositionUpdate(IPosition position)
          {
          if (position.MarketPosition == MarketPosition.Flat)
          {
          // Do something like reset some variables here
          }
          }


          Question is, when NT7 is released, will these user variables also be persistant/retained?

          Comment


            #6
            borland, thank you for the suggestion. I'm not sure what you mean by 'will these variables be persistant/retained'. Could you please clarify?

            Variables will only exist in the scope they are created, and you can set/reset/whatever these variables when you want to. They will not be saved if you close and restart NinjaTrader, for example. Each time you apply an indicator to a chart or a strategy, that counts as one instance of the object and thus variables will stick around for that instance, unless you write to some external area (database, flat file, etc).
            AustinNinjaTrader Customer Service

            Comment


              #7
              Austin,

              After restarting the computer and relaunching NT version 7 (when released).

              I understood that unlike the current version of NT (version 6), version 7 would allow restarting the computer with a running strategy since any changes to a trade position would be automatically saved to file. So, based on that, I was wondering if any user defined Ninjascript variables in a trade Strategy would be also saved?

              Comment


                #8
                borland,

                I am not sure where you got the idea that the strategy writes a trade position to a file. In NT7 there is strategy persistence in that you can persist strategies on the Strategies tab for quick relaunching when you restart NT. This is not to say anything is "saved" in regards to position, etc.

                When restarting a strategy in NT7 you have the option to try and have it match back to live accounts. If it can't you can have it try to sync your account position to the strategy position.
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                0 responses
                669 views
                0 likes
                Last Post Geovanny Suaza  
                Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                0 responses
                378 views
                1 like
                Last Post Geovanny Suaza  
                Started by Mindset, 02-09-2026, 11:44 AM
                0 responses
                111 views
                0 likes
                Last Post Mindset
                by Mindset
                 
                Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                0 responses
                575 views
                1 like
                Last Post Geovanny Suaza  
                Started by RFrosty, 01-28-2026, 06:49 PM
                0 responses
                580 views
                1 like
                Last Post RFrosty
                by RFrosty
                 
                Working...
                X