Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Accessing GetTrades() net profit?

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

    Accessing GetTrades() net profit?

    Hello,

    What is described in the NinjaTrader8 Reference Guide for GetTrades() is that you can identify a certain amount of desired entries in the instance. This is different to the netProfit or AvgProfit functions that utilized all trades within the lifetime of the strategy as shown here:

    SystemPerformance.AllTrades.TradesPerformance.Curr ency.AvgProfit

    Is it possible that where it says "AllTrades", I can change that to "GetTrades()" to get the AvgProfit or netProfit for the desired trades within the instance determined within "GetTrades()".

    Otherwise, is there a more simple way to determine the performance by means of profit, loss, MAE, etc.. of only the previous 15 trades rather than AllTrades?

    Any help is very very very much appreciated as I am doing my best to learn NinjaScript.

    Kind Regards,
    Grant Peace

    #2
    Hello GrantPeace,

    Thank you for your post and welcome to the NinjaTrader Support Forum.

    You can perform this just as I have in the example below for the ES 03-17.
    Code:
    			TradeCollection myTrades = SystemPerformance.AllTrades.GetTrades("ES 03-17", "Entry", 15);
    			Print(myTrades.TradesPerformance.Currency.CumProfit.ToString());
    Please let me know if you have any questions.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    90 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    120 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X