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 timmbbo, Today, 08:59 AM
    1 response
    2 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by KennyK, 05-29-2017, 02:02 AM
    2 responses
    1,281 views
    0 likes
    Last Post marcus2300  
    Started by fernandobr, Today, 09:11 AM
    0 responses
    3 views
    0 likes
    Last Post fernandobr  
    Started by itrader46, Today, 09:04 AM
    1 response
    6 views
    0 likes
    Last Post NinjaTrader_Clayton  
    Started by bmartz, 03-12-2024, 06:12 AM
    5 responses
    33 views
    0 likes
    Last Post NinjaTrader_Zachary  
    Working...
    X