Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 rajendrasubedi2023, Today, 09:50 AM
    0 responses
    6 views
    0 likes
    Last Post rajendrasubedi2023  
    Started by ender_wiggum, Today, 09:50 AM
    0 responses
    2 views
    0 likes
    Last Post ender_wiggum  
    Started by bmartz, Today, 09:30 AM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_Erick  
    Started by geddyisodin, Today, 05:20 AM
    3 responses
    23 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by lorem, Today, 09:18 AM
    1 response
    5 views
    0 likes
    Last Post lorem
    by lorem
     
    Working...
    X