Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to get the P&L from the brokers software?

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

    How to get the P&L from the brokers software?

    Hi,

    I am trying to get the P&L from the TWS of IB.
    See photo attached. I am trying to get the realized P&L when I am closing a trade (-629.04)

    I can't seem to get it. Here is what I tried:

    Print("Net profit is: " + SystemPerformance.RealTimeTrades.TradesPerformance .NetProfit);
    Print("Total commission is: " + SystemPerformance.RealTimeTrades.TradesPerformance .TotalCommission);

    NetProfit gives me a number of: -600
    TotalCommision gives me a number of: 0

    Thanks for helping.

    #2
    Hello zoharcho

    Thank you for the post.

    The prints you have shown would be the values from your strategies virtual performance where as the picture of IB is the actual account value. To access the actual account values you could use the Account property and its Get method. The Get method takes an Account Item: https://ninjatrader.com/support/help...ub=accountitem



    Code:
    Account.Get(AccountItem.RealizedProfitLoss, Currency.UsDollar)
    You can find details on what account values the varous providers offer in the following link: https://ninjatrader.com/support/help...TheAccountsTab

    I look forward to being of further assistance.


    Comment


      #3
      Great explanation.

      I see that every broker sends different information regarding the realized P&L.

      1) I thought of maybe doing it using the execution.Commission interface, on the function OnExecution. Will it get the proper value for the commission?


      2) If the answer is yes, will it get the proper value of the commission for all the brokers?

      Thanks, your explanation is really good, I instantly understand, thumbs up.

      Comment


        #4
        Hello zoharcho,

        As all brokers are different I couldn't say if that would be reported for all of them. If there is commission provided with the execution you could use that however I don't know if that would equal the account PnL you pictured when added to the overall PnL. You could try printing the values for both the execution commission and the strategy Pnl or account PnL to check if it matches what you had pictured.


        I look forward to being of further assistance.

        Comment


          #5
          Thank you Jesse

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by NullPointStrategies, Today, 05:17 AM
          0 responses
          50 views
          0 likes
          Last Post NullPointStrategies  
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          126 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          69 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          42 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          46 views
          0 likes
          Last Post TheRealMorford  
          Working...
          X