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 RideMe, 04-07-2024, 04:54 PM
      5 responses
      28 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by f.saeidi, Today, 08:13 AM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by DavidHP, Today, 07:56 AM
      1 response
      6 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by kujista, Today, 06:23 AM
      3 responses
      9 views
      0 likes
      Last Post kujista
      by kujista
       
      Started by Mindset, Yesterday, 02:04 AM
      2 responses
      18 views
      0 likes
      Last Post NinjaTrader_RyanS  
      Working...
      X