Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

need Performance.SessionTrades

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

    need Performance.SessionTrades

    Why isn't there a Performance.SessionTrades object? You've got All, Real, Long, Short, but it would sure help if you tracked one just for the current Session that automatically reset at the FirstBarOfSession.

    How do I make one?

    I need the count of trades since the beginning of the session, and the Performance data: profit, etc.

    #2
    LostTrader, you would need to check the profit/loss value at the beginning of every session and then you can subtract that amount from the entire profit/loss value to get each individual session's p/l. Please take a look at the reference sample that tracks session profit and loss for money management purposes to get an idea of how to accomplish this - http://www.ninjatrader.com/support/f...ead.php?t=4084.
    AustinNinjaTrader Customer Service

    Comment


      #3
      I've seen that sample, Austin. Simply put, it seems a tad clumsy, and is VERY incomplete.
      It would be simple for y'all to make this. Meanwhile I will try something else.

      Please add a TradeCollection object for SessionTrades to your future enhancements.
      Thank you.

      Comment


        #4
        Originally posted by Lost Trader View Post
        I've seen that sample, Austin. Simply put, it seems a tad clumsy, and is VERY incomplete.
        It would be simple for y'all to make this. Meanwhile I will try something else.

        Please add a TradeCollection object for SessionTrades to your future enhancements.
        Thank you.
        You could always write a function/method to handle this, but I do agree that having it as a property or method of the Performance object would be a whole lot nicer.

        May I add my voice to the feature request?

        Comment


          #5
          when is existing TradeCollection updated?

          Yea, I am trying to write one using the existing structure.

          I need to know when the existing TradeCollection (AllTrades) is updated with the last trade.
          Is it OnExecution(), OnPositionUpdate(),what? When can the last Trade object in the TradeCollection be guaranteed to be the one just closed?

          As long as TradeCollection is akin to C# collections (i.e., Add() and Clear() are TradeCollection methods) then a private TradeCollection can add the last trade from AllTrades and clear itself at every start of Session.

          Comment


            #6
            Checking with development. Will get back to you.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              It will come after OnPositionUpdate().
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Originally posted by NinjaTrader_Josh View Post
                It will come after OnPositionUpdate().
                AFTER?

                Which On Event method can be used to know that a trade has been added to the Collection and that the statistics are now valid?

                Comment


                  #9
                  Lost Trader, yes, after OnPositionUpdate(), the trade performance collection will be 100% updated and valid.

                  You could make a call to your custom function at the very end of OnPositionUpdate() to get this data.
                  AustinNinjaTrader Customer Service

                  Comment


                    #10
                    Austin,
                    does this specifically mean during OnPositionUpdate() when (Position.MarketPosition == MarketPosition.Flat) ? That does sound more realistic than after.

                    More important, are there any other times or condition checks for when a trade is added to the Collection?

                    Can a position have multiple trades? and if so, MarketPosition.Flat would be an incomplete check. What else should be checked?

                    Comment


                      #11
                      Hello,

                      It would be after OnPositionUpdate() runs that everythings good to go. Can't guarentee anything during OnPositionUpdate() this is why we say after.

                      Also, if you need to track this more advanced then long/short/flat you can check the QTY. If this works for your method if it doesn't then you will need to use ATM Strategies. Or track the positions yourself with your own code. Let me know if you need more information on ATM Strategies and I can supply.
                      BrettNinjaTrader Product Management

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      647 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      369 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      108 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      572 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      573 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X