Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Get Realized PnL

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

    Get Realized PnL

    Hi guys,

    I'm trying to get the actual Realized PnL for today because I need to set a maximum loss per day, so I've doing research and found this line of code:
    SystemPerformance.AllTrades.TradesPerformance.Curr ency.CumProfit

    Which is supposed to be the one to get it but when I print that line is not even close to the number I see on my account, which should match because I'm running the strategy only for that account.
    Any ideas?

    #2
    Hello vcapeluto, thanks for your post and welcome to the NinjaTrader forum.

    The Cumulative Profit you are seeing from the SystemPerformance class is including the virtual historical trades that the strategy completed when it loaded onto a chart. This is why you will see executions on your chart when a strategy is enabled. To get real-world account values, use the Account class:
    https://ninjatrader.com/support/help...ount_class.htm

    We have an existing example on setting a daily loss limit:
    https://ninjatrader.com/support/foru...ples#post93881

    Please let me know if I can assist any further.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Hi Chris L.,
      It worked!
      However the commissions and fees are not there right? So I would need to calculate them manually or what?

      Thank you very much!

      Comment


        #4
        Hello vcapeluto, thanks for your reply.

        You must have a Commission Template set up for the account for commission values to reflect on trades, see here for documentation:

        https://ninjatrader.com/support/help...commissi_2.htm

        Kind regards.
        Chris L.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by vantojo, Yesterday, 06:49 PM
        2 responses
        19 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by angeljulio, Today, 05:35 AM
        0 responses
        4 views
        0 likes
        Last Post angeljulio  
        Started by patricia70, Today, 04:41 AM
        0 responses
        10 views
        0 likes
        Last Post patricia70  
        Started by morrnel, Yesterday, 09:12 PM
        1 response
        19 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by 7robert, Yesterday, 04:41 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Jason  
        Working...
        X