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


How to determine result of trades?

  • Filter
  • Time
  • Show
Clear All
new posts

    How to determine result of trades?

    Hi there, how do I determine the failure/success of multiple trades from different strategies?

    Say I have three different strategies, each with 6 point tick profit/stop loss. I'm running all three strategies in the same chart on the same instrument and time frame. Each of these three strategies fires off twice during the trading day. Now, at the end of the trading day, I want to see the results from each individual trade from all three of these different strategies. That is, since I have three strategies, each which fired off twice, I want to see the individual results from all six trades.

    I'm aware of how I can use SystemPerformance.AllTrades, but that captures the cumulative performance. Instead, I need the performance of each individual trade from each strategy, after each trade is completed by the end of day.

    Thanks for your help again,

    Last edited by timmbbo; 01-31-2023, 02:53 PM.

    Hello timmbbo,

    Thanks for your post.

    The Strategy Performance window could be used to view the performance of a strategy. You could use the Trades Display of a Strategy Performance report to compare the results of individual trades.

    See this help guide page for more information about how to use the Strategy Performance feature:

    Please let me know if I may further assist you.
    Brandon H.NinjaTrader Customer Service



      Brandon, thanks. Unfortunately, this isn't the right solution for me, due to error, "The OCO ID cannot be reused"

      In reality, I'm testing hundreds of different strategies at once. I have each strategy as its own individual strategy file. I then load up hundreds of these strategies into a chart, each with different variables. So, I can do the exact same order four times, each with different profit/loss targets. During the trading session, I sometimes get error "The OCO ID cannot be reused". Then, on that trade, the stop loss and profit targets are not honored, leading to unpredictable behavior. I think what's going on is, I have trades firing off simultaneously to NT, and NT is getting the handles confused between these simultaneous orders.

      To fix this, I'm going to put all of my different strategies into one master strategy file. This way, all orders will then be submitted sequently. The bummer of this method though, is, I need now to keep track of the performance of each induvial trade.

      So, working through my example, I have one strategy, which four variations of profit/loss stops. If I run this as four different strategies, I can get the "The OCO ID cannot be reused" error. So, it's now my goal to combine into one single strategy, and then fire off four orders with the different profit/loss set, and then keep track of the success of each of those orders.

      Your thoughts? Thanks again.


        Hello timmbbo,

        Thanks for your note.

        The error "The OCO ID cannot be reused" indicates that your strategy has submitted an order that is reusing an OCO ID. You would need to ensure that the strategy instance is submitting new OCO-tied orders using unique OCO IDs.

        You could consider adding something to each submitted instance of the protective orders that are unique like CurrentBar.

        An example script shared by my colleague Chelsea demonstrating using OCO-tied orders could be seen on this forum thread:

        To access information about trades made by a strategy you may use the SystemPerformance.AllTrades collection. Note that a trade consists of an Entry and Exit.​

        You could consider looping through the trades in the SystemPerformance.AllTrades TradeCollection to get TradesPerformance information about each trade made. See example number 2 on the TradeCollection help guide page for an example of looping through a TradeCollection.

        GetTrades() could be used to get information about a specific instance of a trade defined by its entrySignalName.


        Let me know if I may assist further.
        Brandon H.NinjaTrader Customer Service


        Latest Posts


        Topics Statistics Last Post
        Started by ChrisR, Yesterday, 09:24 PM
        3 responses
        Last Post ChrisR
        by ChrisR
        Started by balltrader, Today, 10:06 AM
        6 responses
        1 like
        Last Post QuantKey_Bruce  
        Started by Attila, 03-07-2023, 09:47 AM
        4 responses
        Last Post BartMan
        by BartMan
        Started by BartMan, Today, 03:59 PM
        0 responses
        Last Post BartMan
        by BartMan
        Started by QuantKey_Bruce, 03-29-2023, 02:31 PM
        10 responses
        Last Post BartMan
        by BartMan