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 cmtjoancolmenero, Yesterday, 03:58 PM
          1 response
          17 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by benmarkal, Yesterday, 12:52 PM
          3 responses
          23 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by helpwanted, Today, 03:06 AM
          1 response
          20 views
          0 likes
          Last Post sarafuenonly123  
          Started by Brevo, Today, 01:45 AM
          0 responses
          12 views
          0 likes
          Last Post Brevo
          by Brevo
           
          Started by pvincent, 06-23-2022, 12:53 PM
          14 responses
          244 views
          0 likes
          Last Post Nyman
          by Nyman
           
          Working...
          X