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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X