Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Performance Report Doesn't Reflect Actual Results

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

    Performance Report Doesn't Reflect Actual Results

    I am sending my phone a message when a sim account trading an automated strategy is flat
    and I'm trying to send the profit and loss for that account for the day. However, the number I am getting in my message doesn't agree with what I see in the account itself. Here's the
    code I am using, and then the message it generates, and finally what I actually see in the account.

    Code:
    Variable4 = Performance.AllTrades.TradesPerformance.Currency.CumProfit;
    SendMail("[email protected]", "[email protected]", "Time " + Time[0] + "   No Open Positions ", "Current P and L for "  + Account.Name  + " for the day is  " + Variable4);
    Actual Message from above Code running on Sim103 Account.
    (Time 10/5/2012 7:16:15 AM No Open Positions) Current P and L for Sim103 for the day is 10072.1473667889

    Account Actual Gain for the day is: -578,12.

    I don't know how to relate the 10072.147... to the amount I actually see which is in fact a loss of more than $500. Am I getting Variable4 incorrectly?

    Thanks

    DaveN

    #2
    Hello daven,
    Performance.AllTrades.TradesPerformance.Currency.C umProfit returns the cumulative PnL taken by the strategy for both historical bars and realtime bars. If you want to email the PnL of your account balance then please use the below code.
    Code:
    GetAccountValue(AccountItem.RealizedProfitLoss);
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      That fixed it. Thank you so much for your help.
      DaveN

      Comment


        #4
        Not to push it too hard but is there a construct similar to the one you just gave me that lets me report on the gain or loss of just the last closed trade?
        Thanks Again
        DaveN

        Comment


          #5
          Hello daven,
          You can use the below code to get the PnL of the last closed trade.
          Code:
          if (Performance.RealtimeTrades.Count > 0)
          double pnl = Performance.RealtimeTrades[this.Performance.RealtimeTrades.Count - 1].ProfitCurrency;
          JoydeepNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          88 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          48 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          30 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          34 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          68 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X