Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

GetProfitLoss discrepancies

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

    GetProfitLoss discrepancies

    Hi,

    I'm using the following to print the trades profits/loss, but find that what's printed is less than what appears in executions and trades in account performance.

    Code:
    TradePL = Position.GetProfitLoss(Close[0], PerformanceUnit.Currency);
    
    DrawText(""+CurrentBar, Math.Round(TradePL,2).ToString(), 0, High[0] - (TickSize *10), Color.Yellow);
    Why the discrepancies?
    Thanks in advance

    #2
    Hello 2Look4me,

    Thank you for your post.

    This would only print out the values from the strategy's performance and not that of the entire account.

    Please let me know if you have any questions.

    Comment


      #3
      Hi Patrick,

      That I understand. But for instance; Buy: 951.2 Sell: 949 Account Performance= (224.30) and GetProfitLoss= (232.15) or Buy: 950.7 Sell: 949.2; Account Performance = (154.30) and GetProfitLoss= (152.15)

      Comment


        #4
        Hello,
        Do you have commissions factored in with your account performance trades?
        The GetProfitLoss() method is the unrealized PnL and would not include commissions if they are set up. Unrealized PnL is not factored into realized PnL until the trade is closed. The account performance only shows the performance of trades that have been closed, not positions you are in currently.
        Cody B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by RubenCazorla, Today, 09:07 AM
        2 responses
        12 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by i019945nj, 12-14-2023, 06:41 AM
        7 responses
        82 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by timmbbo, 07-05-2023, 10:21 PM
        4 responses
        158 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by tkaboris, Today, 08:01 AM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by Lumbeezl, 01-11-2022, 06:50 PM
        31 responses
        819 views
        1 like
        Last Post NinjaTrader_Adrian  
        Working...
        X