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 CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    52 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    29 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    194 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Started by CaptainJack, 04-24-2026, 11:07 PM
    0 responses
    355 views
    0 likes
    Last Post CaptainJack  
    Started by Mindset, 04-21-2026, 06:46 AM
    0 responses
    274 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Working...
    X