Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Cumulative profit

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

    Cumulative profit

    I want to know inside strategy how much my strategy made loss or profit.

    I am using create atm for trades.

    If I use sample cumulative profit calculations it shows me zero profit all the time, I tried to search from forum. not found solutions

    I tried to use this example:


    if (Bars.FirstBarOfSession)
    {
    // Store the strategy's prior cumulated realized profit and number of trades
    priorTradesCount = Performance.AllTrades.Count;
    priorTradesCumProfit = Performance.AllTrades.TradesPerformance.Currency.C umProfit;

    /* 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. */
    }

    /* Prevents further trading if the current session's realized profit exceeds $1000 or if realized losses exceed $400.
    Also prevent trading if 10 trades have already been made in this session. */
    if (Performance.AllTrades.TradesPerformance.Currency. CumProfit - priorTradesCumProfit >= 1000
    || Performance.AllTrades.TradesPerformance.Currency.C umProfit - priorTradesCumProfit <= -400
    || Performance.AllTrades.Count - priorTradesCount > 10)
    {
    /* TIP FOR EXPERIENCED CODERS: This only prevents trade logic in the context of the OnBarUpdate() method. If you are utilizing
    other methods like OnOrderUpdate() or OnMarketData() you will need to insert this code segment there as well. */

    // Returns out of the OnBarUpdate() method. This prevents any further evaluation of trade logic in the OnBarUpdate() method.
    return;
    }

    #2
    no problem anymore i think i found solution

    GetAccountValue(AccountItem.RealizedProfitLoss

    Comment


      #3
      jokujoku, good to hear you found a solution. Please let us know if you have any other questions.
      AustinNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

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