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 lorem, Yesterday, 09:18 AM
          4 responses
          13 views
          0 likes
          Last Post lorem
          by lorem
           
          Started by Spiderbird, Today, 12:15 PM
          0 responses
          5 views
          0 likes
          Last Post Spiderbird  
          Started by cmtjoancolmenero, Yesterday, 03:58 PM
          12 responses
          42 views
          0 likes
          Last Post NinjaTrader_ChelseaB  
          Started by FrazMann, Today, 11:21 AM
          0 responses
          6 views
          0 likes
          Last Post FrazMann  
          Started by geddyisodin, Yesterday, 05:20 AM
          8 responses
          52 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Working...
          X