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 algospoke, Yesterday, 06:40 PM
      2 responses
      20 views
      0 likes
      Last Post algospoke  
      Started by ghoul, Today, 06:02 PM
      3 responses
      14 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by jeronymite, 04-12-2024, 04:26 PM
      3 responses
      45 views
      0 likes
      Last Post jeronymite  
      Started by Barry Milan, Yesterday, 10:35 PM
      7 responses
      21 views
      0 likes
      Last Post NinjaTrader_Manfred  
      Started by AttiM, 02-14-2024, 05:20 PM
      10 responses
      181 views
      0 likes
      Last Post jeronymite  
      Working...
      X