• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get cumulative profit and loss of current session

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

    Get cumulative profit and loss of current session

    Hello,

    How can I get the total profit and loss per session? Ideally this would reset each trading day and update OnBarUpdate and would also include the Unrealised profit and loss Can you provide a little example of how to do it ?

    Thanks for your help

    #2
    Hi roblogic,

    Thanks for your post.

    You can use the SystemPerformance class to get strategy performance data. See this reference sample that demonstrates how to reset values at the beginning of a new trading session.

    Please let me know if you have any questions.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Thanks for your response. What I want to check OnBarUpdate is the Total PnL as it is displayed in the accounts tab.

      This resets each trading day, automatically as session close, updates OnBarUpdate and has both the realised and unrealised PnL. Maybe the title of the thread is a bit misleading but this is what I need. Please can you be specific on how to track this Total PnL?

      Comment


        #4
        Hi roblogic, thanks for the follow-up.

        Taking the session PnL for the real account would require more code to be written in your script. You would need to use the Account object that your strategy has and get all the executions that occurred on the account for the session, then calculate the PnL for all of the executions.

        Please let me know if you have any further questions on this material.
        Chris L.NinjaTrader Customer Service

        Comment


          #5
          Ok thanks for the clarification. And if I want to track the evolution of the cumulative PnL only on historical data I assume the account class won't work. Correct? Then what would you suggest?

          Comment


            #6
            Hi roblogic, thanks for your reply.

            No, using the Account object would not work in historical backtest. You would need to use the SystemPerformance class to track historical values from the strategy.

            Kind regards.
            Chris L.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by chazyang, Today, 02:01 AM
            1 response
            3 views
            0 likes
            Last Post chazyang  
            Started by tonynt, Today, 01:20 AM
            0 responses
            13 views
            0 likes
            Last Post tonynt
            by tonynt
             
            Started by sdauteuil, Yesterday, 11:02 PM
            1 response
            3 views
            0 likes
            Last Post sdauteuil  
            Started by Jschmelz, Yesterday, 04:45 PM
            1 response
            9 views
            0 likes
            Last Post NinjaTrader_Marco  
            Started by sisenberg, Yesterday, 08:06 PM
            1 response
            11 views
            0 likes
            Last Post sisenberg  
            Working...
            X