Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access to performance metrics

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

    Access to performance metrics

    My strategy requires access to various performance metrics:

    (1) <net profit> + <open position profit> - <total commissions paid>
    While I've been able to find TradesPerformance.NetProfit, I could not find the other fields. Obviously, NinjaTrader knows these values - how can I access them?

    (2) I would really like to create my own performance metrics object and use it's values in the strategy. I have added methods to access the values I am after to my custom performance metrics object. However, it seems I can't access these values from the strategy. Is there a sample available showing how to do that?


    Thank you,
    best regards, Felix

    #2
    I've been able to partially answer my own question:
    1)
    double netProfit = SystemPerformance.AllTrades.TradesPerformance.NetP rofit;
    double totalCommission = SystemPerformance.AllTrades.TradesPerformance.Tota lCommission;

    2)


    However, the question regarding the open position profit still stands. This is what I have been trying:
    double openPositionProfit = 0;
    for (int i = 0; i < Positions.Length; i++)
    {
    switch(Positions[i].MarketPosition)
    {
    case MarketPosition.Long:
    openPositionProfit += Positions[i].GetUnrealizedProfitLoss(PerformanceUnit.Currency, Closes[i][0]);
    break;
    }
    }


    Unfortunately the value returned by that code is nowhere close to correct. This may or may not be related to the fact that I am scaling position sizes on a daily basic, which might screw up the accuracy of the average entry price. Is there a better way to do this?

    Thank you,
    best regards, Felix

    Comment


      #3
      filed a bug here: http://ninjatrader.com/support/forum...387#post479387

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X