Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Net Profit or Loss for Today

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

    Net Profit or Loss for Today

    I've looked at your TradeCollection and Performance properties in the guide, and I see how you can get Long trades and Short trades and All trades, and winners and losers, but what about Today's net profit or loss. How would you make Today's net profit/loss Print to the output window from a strategy?
    Thanks

    #2
    Hello kenb2004,

    You would have to do some custom calculations for example:

    Code:
    if (Bars.FirstBarOfSession)
    			{
    				// Store the strategy's prior cumulated realized profit
    				priorTradesCumProfit = Performance.AllTrades.TradesPerformance.Currency.CumProfit;
    				/* NOTE: Using .AllTrades will include both historical virtual trades as well as real-time trades.
    				If you want to only count profits from real-time trades please use .RealtimeTrades. */
    			}
    			
    			Print("Today's Profit: "+(Performance.AllTrades.TradesPerformance.Currency.CumProfit - priorTradesCumProfit));
    The following forum post you can use as a reference when working with trade performance statistics.
    http://www.ninjatrader.com/support/f...ead.php?t=4084
    JCNinjaTrader Customer Service

    Comment


      #3
      Hey JC

      Thanks for the code.

      Comment


        #4
        How can you print results for the prior trade pnl when a new trade is executed in a strategy?

        Comment


          #5
          Hello brucelevy,

          Thank you for writing in.

          I would suggest taking a look at this help guide link: https://ninjatrader.com/support/help...nt7/?trade.htm

          There is an example that shows how to calculate the PnL for the last completed real-time trade.

          Please, let us know if we may be of further assistance.
          Zachary G.NinjaTrader Customer Service

          Comment


            #6
            Ok it's working great now but prints the message continuously. I have it in the OnBarUpdate section... and CalculateOnBarClose = true;

            Does it need a check to stop it from continually printing? I am asking because it is connected to sendmail.

            Comment


              #7
              Hello,
              This would depend on how you have the logic setup for the print.
              Please provide a snippet from your code that covers your print so we may investigate further.
              Cody B.NinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by argusthome, 03-08-2026, 10:06 AM
              0 responses
              69 views
              0 likes
              Last Post argusthome  
              Started by NabilKhattabi, 03-06-2026, 11:18 AM
              0 responses
              42 views
              0 likes
              Last Post NabilKhattabi  
              Started by Deep42, 03-06-2026, 12:28 AM
              0 responses
              24 views
              0 likes
              Last Post Deep42
              by Deep42
               
              Started by TheRealMorford, 03-05-2026, 06:15 PM
              0 responses
              27 views
              0 likes
              Last Post TheRealMorford  
              Started by Mindset, 02-28-2026, 06:16 AM
              0 responses
              54 views
              0 likes
              Last Post Mindset
              by Mindset
               
              Working...
              X